5

I am using Dynamics 365 online instance to integrate sales process. I have one condition where I need to change the Probability field value to 100 when user clicks on Finish button in Close Process Stage.

enter image description here

I have done some research and found that (OnProcessStatusChange event) can help to get business process flow status change (statuses: Active, Finished, or Aborted)

Ref Link: OnProcessStatusChangeEvent

I have checked this by adding this to form OnLoad event like below, but nothing happens.

Xrm.Page.data.process.addOnProcessStatusChange(setProbablityOnFinish);

Is there any other solution?

4
  • Does the eventhandler ‘setProbablityOnFinish’ exist? Commented Dec 23, 2017 at 11:36
  • Yes ‘setProbablityOnFinish’ is already there which i haven't mentioned in my post.
    – Cyber
    Commented Dec 24, 2017 at 6:24
  • any error on browser console? Debug result? Commented Dec 24, 2017 at 14:18
  • HI Vinoth, Did you find any solution for this ? I want to trigger one java script function when user clicks on finish button in side of a business flow ? Is this possible ?
    – Naurto san
    Commented Dec 2, 2021 at 9:31

1 Answer 1

7

Make sure you implement the eventhandler like this, it will work.

function OnLoad() {
   Xrm.Page.data.process.addOnProcessStatusChange(statusOnChange);
}

function statusOnChange() {
   status = Xrm.Page.data.process.getStatus();
   if (status == "finished") {
       //Write your logic here//
   }
}
1
  • Thanks Vinoth its working. I created a new Web Resource and try this.
    – Cyber
    Commented Dec 26, 2017 at 3:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.