Notifications
Announcements
No record found.
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
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.
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?
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.
Thanks Adrian! I'm gong to try your suggestion...
Is there a way to get a stageId by stage name?
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.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2