Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Has setDisabled been deprecated? I'm getting this error - formContext.ui.tabs.get(...).setDisabled is not a function

$
0
0

Hello, 

I've been receiving the following error in my code once I've injected it onto my form - formContext.ui.tabs.get(...).setDisabled is not a function

Here is my code:

function HideAndDisableTabsBasedOnBPFStage(executionContext) {
    var formContext = executionContext.getFormContext();
    // Hide and disable tabs based on the current BPF stage
    var bpfStageId = formContext.data.process.getActiveStage().getId();
    switch (bpfStageId) {
        case "abbda151-be8f-462a-99b9-b32231baadaf":
            // Hide and disable tabs for Request stage
            formContext.ui.tabs.get("tab_Requestor").setVisible(true);
            formContext.ui.tabs.get("tab_CourtApprover").setVisible(false);
            formContext.ui.tabs.get("tab_JBSIS").setVisible(false);
            formContext.ui.tabs.get("tab_CTS").setVisible(false);
            formContext.ui.tabs.get("tab_Finance").setVisible(false);
            formContext.ui.tabs.get("tab_CTSEntry").setVisible(false);
            break;
        case "ea3aa60c-f952-4edb-b955-c78c2cebc3a6":
            // Hide and disable tabs for Court Approver stage
            formContext.ui.tabs.get("tab_Requestor").setVisible(true);
            formContext.ui.tabs.get("tab_CourtApprover").setVisible(true);
            formContext.ui.tabs.get("tab_JBSIS").setVisible(false);
            formContext.ui.tabs.get("tab_CTS").setVisible(false);
            formContext.ui.tabs.get("tab_Finance").setVisible(false);
            formContext.ui.tabs.get("tab_CTSEntry").setVisible(false);
            break;
        case "0d92ffa6-786d-4e4b-b790-695f4495c7a7":
            // Hide and disable tabs for Court Approver (non-charging) stage
            formContext.ui.tabs.get("tab_Requestor").setVisible(true);
            formContext.ui.tabs.get("tab_CourtApprover").setVisible(true);
            formContext.ui.tabs.get("tab_JBSIS").setVisible(false);
            formContext.ui.tabs.get("tab_CTS").setVisible(false);
            formContext.ui.tabs.get("tab_Finance").setVisible(false);
            formContext.ui.tabs.get("tab_CTSEntry").setVisible(false);
            break;
        case "bdcfd44f-6b69-47ef-9785-a7a3c029169c":
            // Hide and disable tabs for JBSIS stage
            formContext.ui.tabs.get("tab_Requestor").setVisible(true);
            formContext.ui.tabs.get("tab_Requestor").setDisabled(true);
            formContext.ui.tabs.get("tab_CourtApprover").setVisible(true);
            formContext.ui.tabs.get("tab_CourtApprover").setDisabled(true);
            formContext.ui.tabs.get("tab_JBSIS").setVisible(true);
            formContext.ui.tabs.get("tab_CTS").setVisible(false);
            formContext.ui.tabs.get("tab_Finance").setVisible(false);
            formContext.ui.tabs.get("tab_CTSEntry").setVisible(false);
            break;
        case "bccdfa2d-831a-4f4e-a370-c0d3b130914b":
            // Hide and disable tabs for Finance stage
            formContext.ui.tabs.get("tab_Requestor").setVisible(true);
            formContext.ui.tabs.get("tab_Requestor").setDisabled(true);
            formContext.ui.tabs.get("tab_CourtApprover").setVisible(true);
            formContext.ui.tabs.get("tab_CourtApprover").setDisabled(true);
            formContext.ui.tabs.get("tab_JBSIS").setVisible(false);
            formContext.ui.tabs.get("tab_CTS").setVisible(false);
            formContext.ui.tabs.get("tab_Finance").setVisible(true);
            formContext.ui.tabs.get("tab_CTSEntry").setVisible(false);
            break;
        case "fcfaceed-fc37-4dde-9351-f8942fe2b73f":
            // Hide and disable tabs for CTS Review stage
            formContext.ui.tabs.get("tab_Requestor").setVisible(true);
            formContext.ui.tabs.get("tab_Requestor").setDisabled(true);
            formContext.ui.tabs.get("tab_CourtApprover").setVisible(true);
            formContext.ui.tabs.get("tab_CourtApprover").setDisabled(true);
            formContext.ui.tabs.get("tab_JBSIS").setVisible(false);
            formContext.ui.tabs.get("tab_CTS").setVisible(true);
            formContext.ui.tabs.get("tab_Finance").setVisible(false);
            formContext.ui.tabs.get("tab_CTSEntry").setVisible(false);
            break;
        case "f712096e-f750-4b6e-a10e-0e8d3184387e":
            // Hide and disable tabs for CTS Entry stage
            formContext.ui.tabs.get("tab_Requestor").setVisible(true);
            formContext.ui.tabs.get("tab_Requestor").setDisabled(true);
            formContext.ui.tabs.get("tab_CourtApprover").setVisible(true);
            formContext.ui.tabs.get("tab_CourtApprover").setDisabled(true);
            formContext.ui.tabs.get("tab_JBSIS").setVisible(true);
            formContext.ui.tabs.get("tab_JBSIS").setDisabled(true);
            formContext.ui.tabs.get("tab_CTS").setVisible(true);
            formContext.ui.tabs.get("tab_CTS").setDisabled(true);
            formContext.ui.tabs.get("tab_Finance").setVisible(true);
            formContext.ui.tabs.get("tab_Finance").setDisabled(true);
            formContext.ui.tabs.get("tab_CTSEntry").setVisible(true);
            break;
        default:
            break;
    }
}

// Add event handlers for OnLoad and OnStageChange events
Xrm.Page.data.process.addOnLoad(HideAndDisableTabsBasedOnBPFStage);
Xrm.Page.data.process.addOnStageChange(HideAndDisableTabsBasedOnBPFStage);
Thanks in advance!

Viewing all articles
Browse latest Browse all 79901


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>