Hi,
I got this below code from the community, code is for when changing the BPF stages, Tabs visible.
Now issue when changing the stages, Tab is not getting visible but it is visible only after manually refreshing the whole page. Each time i need to refresh page when moving to next stage.
Please help !
Below is the code :
function checkBPF()
{
var activeStage = Xrm.Page.data.process.getActiveStage();
var stageId = activeStage.getId();
var stagename = activeStage.getName();
// you can apply your if else logic to show hide the tab, you can use stageid or stagename, depending on your preferences.
if( stagename == "Discovery")
{
Xrm.Page.ui.tabs.get("Discovery").setVisible(true); //set your tabname here.
Xrm.Page.ui.tabs.get("Proposal").setVisible(false);//set your other tabname here.
Xrm.Page.ui.tabs.get("Advocacy").setVisible(false);
Xrm.Page.ui.tabs.get("Close").setVisible(false);
}
else if ( stagename == "Proposal")
{
Xrm.Page.ui.tabs.get("Proposal").setVisible(true);
Xrm.Page.ui.tabs.get("Advocacy").setVisible(false);
Xrm.Page.ui.tabs.get("Close").setVisible(false);
}
else if ( stagename == "Advocacy")
{
Xrm.Page.ui.tabs.get("Advocacy").setVisible(true);
Xrm.Page.ui.tabs.get("Close").setVisible(false);
}
else if ( stagename == "Close")
{
Xrm.Page.ui.tabs.get("Close").setVisible(true);
}
}
function formonload()
{
Xrm.Page.data.process.addOnStageChange(checkBPF);
checkBPF();
}