Search code examples
.netdynamics-crmdynamics-crm-365

Programmatically finishing business process flow in Dynamics CRM 365


I am managing the whole CRM process flow in C# code, using the newest SDK version (8.2). Moving forward works fine, simply by updating the stageid on the relevant entity. However I have no idea, how could I finish the last stage = how could I set process to finished. I'd like to call exactly the same actions as with clicking the button "set finished"


Solution

  • To set the current status of the active process instance to finished use:

    Xrm.Page.data.process.setStatus("finished");
    

    From the Microsoft documentation:

    Xrm.Page.data.process.setStatus(status, callbackFunction);
    

    status is a string that can be active, abandoned or finish. callbackFunction is an optional function to call when the operation is complete.

    Note: though the documentation says to use finish this does not work: use finished.