Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Business Process Flow SetActiveStage not reflecting

$
0
0

Hi All,

I have a Business Process Flow in my opportunity page. My scenario is when that while the user tries to move to back stage the system should restrict and move them to the original stage. Later when they raise a ticket it would be moved back. So I had a java script on back stage button to trigger. But when I tried steActiveStage function it passed though the code  but din't reflect (the stage din't set to the original stage) it moved to the new back stage. I have included my code below. Please help.

function OppLoad() {
	debugger;
	Xrm.Page.data.process.addOnStageChange(stageChangeEvent);
}

function stageChangeEvent(ExecutionContextObj) {
debugger;
	var PreStage = Xrm.Page.getAttribute("ccs_processstage").getValue();//Id of the previous stage
	if(ExecutionContextObj.getEventArgs().getDirection()=="Previous")
	{
		if(PreName != "Order")
		{
			Xrm.Utility.confirmDialog("You Don't have permission to Move to previous stage. Please Raise a ticket",
				function () {
					Xrm.Page.data.process.setActiveStage(PreStage, function () {
						alert("Moved To Stage");
						});
					}, 
				function () {
					Xrm.Page.data.process.setActiveStage(PreStage, function () {
						alert("Moved To Stage");
						});
				}
			);
		}
		else
		{
			Xrm.Utility.alertDialog("You can't move to back stage since the Opportunity is Closed",
			function () {
				Xrm.Page.data.process.setActiveStage(PreStage, function () {
					alert("Moved To Stage");
					});
				}
			);
		}
	} 
	

Thanks And Regards,

Allwyn Christopher S


Viewing all articles
Browse latest Browse all 46379

Trending Articles