Hi experts,
I have 3 stages in my BPF identify, research, and resolve. I would like to expand and collapse the tabs labelled General, Case Relationships, and Associated Knowledge Records.
I would like collapse the General tab when the research stage is active and collapse the Case Relationships tab when the resolve stage is active.
I am using the following code to test the requirement, but its not working:
function HideShow() { var stage = Xrm.Page.data.process.getActiveStage().getName(); if (stage == "identify") Xrm.Page.ui.tabs.get("CASERELATIONSHIP_TAB").setDisplayState('expanded'); else if (stage == "research") Xrm.Page.ui.tabs.get("CASERELATIONSHIP_TAB").setDisplayState('collapsed'); }
Please suggest changes that I can make to the code.
Thanks,
Jon
*This post is locked for comments
Thanks Jon!
Glad to know it solved your issue.
Hi Shaminder,
IT WORKS!! Thank you so much!!! You're a really strong coder!
Best,
Jon
Hi Jon,
I have modified your code.Please try to run the below
function HideShow()
{
var stage = Xrm.Page.data.process.getActiveStage().getName();
alert(stage);
if (stage === "Identify")
Xrm.Page.ui.tabs.get("CASERELATIONSHIP_TAB").setDisplayState("collapsed");
else if (stage === "Research")
Xrm.Page.ui.tabs.get("CASERELATIONSHIP_TAB").setDisplayState("collapsed");
Xrm.Page.data.process.addOnStageChange(function(e){
var stage= e.getEventArgs().getStage().getName();
if (stage === "Identify")
Xrm.Page.ui.tabs.get("CASERELATIONSHIP_TAB").setDisplayState("collapsed");
else if (stage === "Research")
Xrm.Page.ui.tabs.get("CASERELATIONSHIP_TAB").setDisplayState("collapsed");
});
}
-Shaminder
This is the code I am using onLoad() of form. I would like for it to change every time the user changes the BPF stage.
function HideShow() { var stage = Xrm.Page.data.process.getActiveStage().getName(); alert(stage); if (stage === "Identify") Xrm.Page.ui.tabs.get("CASERELATIONSHIP_TAB").setDisplayState("collapsed"); else if (stage === "Research") Xrm.Page.ui.tabs.get("CASERELATIONSHIP_TAB").setDisplayState("collapsed"); }
Hi Shaminder,
Just another update: I got my code to work now. It was in fact a uppercase lowercase problem.
However, I still want the tab to also expand/collapse when the user changes (onChange) stages of the BPF on the form. How can I accomplish this?
Thanks,
Jon
Hi Shaminder,
Thank you for your reply once again.
I made the change as you suggested but its not working.
Also this script is set on load of the form, so when the page loads it will see the active stage and expand/collapse tabs accordingly.
However, I want the tab to also expand/collapse when the user changes (onChange) stages of the BPF on the form.
Thanks,
Jon
Hi Jon,
Your code is right,just makes sure while comparing take care of lowecase and uppercase
make the change like below for every if condition to
if ( String(stage).toLowerCase() === "identify")
-Shaminder
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156