How to Hide And Show the Tab Based on The Business Process Stage In Dynamic CRM.

 


                                                                                                                                                                  function formonload(executionContext) {

    debugger;

    alert("ABC");

    var formContext=executionContext.getFormContext();

    formContext.data.process.addOnStageChange(checkMoveStage);

     }

    function checkMoveStage(executionContext) {

    alert("dgh");

    var formContext=executionContext.getFormContext();

    //var stage = formContext.data.process.getActiveStage().getName();

    var stage = formContext.data.process.getSelectedStage();

    var stageName= stage.getName();

    if(stageName== "R")

    {

     // formContext.ui.tabs.get("D").setVisible(false);​

    var tabObj = formContext.ui.tabs.get("tab_10");

    tabObj.setVisible(false);

    alert("R")

    }

    else if(stageName=="O")

    {

    var tabObj = formContext.ui.tabs.get("tab_10");

    tabObj.setVisible(false);

    alert("O")

    }

    else if(stageName=="S")

    {

    var tabObj = formContext.ui.tabs.get("tab_10");

    tabObj.setVisible(false);

    alert("Soff")

    }

    else if(stageName=="Invt")

    {

    var tabObj = formContext.ui.tabs.get("tab_10");

    tabObj.setVisible(false);

    alert("IVST")

    }

    else if(stageName=="D")

    {

    var tabObj = formContext.ui.tabs.get("tab_10");

    tabObj.setVisible(true);

    alert("D")

    }

    }


Note : You need to create two Event Handler . In the case I have created two event handler one is formonload (Form On load) and second one is  checkMoveStage (Form On load).







Comments

Post a Comment

Popular posts from this blog

latest dynamics 365 interview questions for more than 2 years of experience

difference between enable rule vs display rule in ribbon workbench

If i create one record that created record date is older than 3 days, then I want to perform some operation with the help of business rule.