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
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,
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.
Thanks Adrian! I'm gong to try your suggestion...
Is there a way to get a stageId by stage name?
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.
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?
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.
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
52
Victor Onyebuchi
6