Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Select tab based on active stage

(0) ShareShare
ReportReport
Posted on by 27
Hi everyone,
 
Could anyone share sample js script for directing the user to a specific tab in a Form, based on the active stage in a business process flow?
 
Best regards,
Imran Khan
  • Suggested answer
    Ami K Profile Picture
    Ami K 27 on at
    Select tab based on active stage
    One solution:
     
    ​
    function onLoad(executionContext) {
        var formContext = executionContext.getFormContext();
        formContext.data.process.addOnStageChange(onStageChange)
    }
    
    function onStageChange(executionContext) {
        var formContext = executionContext.getFormContext();
        var stage = formContext.data.process.getSelectedStage();
        var stageName = stage.getName();
    
        if (stageName == "Draft") {
            formContext.ui.tabs.get("tab_one").setFocus();
        } else if (stageName == "Submitted For Approval") {
            formContext.ui.tabs.get("tab_two").setFocus();
        } else if (stageName == "Approved") {
            formContext.ui.tabs.get("tab_three").setFocus();
        }
    }
    
    
     
  • Ami K Profile Picture
    Ami K 27 on at
    Select tab based on active stage
    I am aware of using of set focus to move to a specific tab, my question was whether had anyone any js script to move to a specific tab when the active stage has changed.
     
    Best regards,
    Imran Khan
  • Suggested answer
    Haig Liu Profile Picture
    Haig Liu Microsoft Employee on at
    Select tab based on active stage
    Hi ImranAmi,
     
    Using the Dynamic 365 Sales opportunity table as an example, the pipeline phase field on the opportunity table records the BPF stage.
    So when the pipeline phase field changes we can apply the JS code in the link to focus the tab:
     
    Best Regards,
    Haig Liu

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans