Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Trigger to set next business process stage active

(0) ShareShare
ReportReport
Posted on by

How can I trigger to set next stage of a business process, active, based on a no/yes field filled out?

Thanks!

*This post is locked for comments

  • Suggested answer
    Adrian Begovich Profile Picture
    1,025 Super User 2025 Season 1 on at
    RE: Trigger to set next business process stage active

    Hi Barry,

    I am not sure what you would need that for, as you can get both the Stage Id and the Stage Name from a stage using JavaScript.

    You may find the other JavaScript methods for Business Process Flows found on this link to be useful.

  • Community Member Profile Picture
    on at
    RE: Trigger to set next business process stage active

    Thanks Adrian! I'm gong to try your suggestion...

    Is there a way to get a stageId by stage name?

  • Suggested answer
    Adrian Begovich Profile Picture
    1,025 Super User 2025 Season 1 on at
    RE: Trigger to set next business process stage active

    Hi Barry,

    You can get the StageId using this JavaScript.

    function onLoad() {
    Xrm.Page.data.process.addOnStageChange(getStage);
    getStage();
    }

    function getStage() {
    var activeStage = Xrm.Page.data.process.getActiveStage();
    var stageId = activeStage.getId();
    var stageName = activeStage.getName();
    }

    The old StageId JavaScript is deprecated in Dynamics 365, as it can no longer reliably be used to determine which process is running on a record or as triggers to workflows or other automated tracking. More information on this can be found here.

  • Community Member Profile Picture
    on at
    RE: Trigger to set next business process stage active

    Thanks Goutam!

    I am going to try your suggestion I'm just wondering how do I know the stageId for the stage I want to set active?

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Trigger to set next business process stage active

    Hi Barry,

    You can simply call a javascript function on change of two option field. In the javascript function you need to write following.

    If option value is yes then save the data first and then move to next stage.

    Xrm.Page.data.entity.save();

    Xrm.Page.data.process.setActiveStage(stageId, callbackFunction);

    You need to provide stage I'd which you want to redirect .

    Hope this helps.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans