Search code examples
javascriptdynamics-crm

How can I tell if user is moving to next or previous stage of business process flow when OnStageChange event is fired in Dynamic 365 Online?


I'm writing a JS script to intercept and do some additional validations when user moved to the next stage of business process flow in Dynamic 365 Online.

I'm binding my function to OnStageChange event of Dynamic 365, but that event is not only fired when a user moved to next stage but also when he moved back to previous stage as well.

Is the any way to tell if the user is moving to the next or the previous stage?


Solution

  • You'll need to update your code for the OnStageChange to getEventArgs, this will allow you to see if the getDirection was 'next' or 'previous.'

    Without seeing your code, I can't provide specific implementation advice, but this answers your question.

    Below is the link for further understanding how to handle `OnStageChange' events:

    https://msdn.microsoft.com/en-us/library/gg334481.aspx#BKMK_OnStageChange