MSCRM 2015 Business Process stages and steps list using Javascript


We have a new feature in Microsoft Dynamics CRM 2015, to get all Stages along with Steps.

Below is the code to get it.

//Retrieve all Stages and Step Names against a Business process- works in 2015
function GetBusinessProcess() {
    var message="";
    var activePathCollection = Xrm.Page.data.process.getActivePath();
    activePathCollection.forEach(function (stage, n) {
        message += "Stage Index: " + n + "\n";
        message += "Entity: " + stage.getEntityName() + "\n";
        message += "StageId: " + stage.getId() + "\n";
        message += "Status: " + stage.getStatus() + "\n";
        var stageSteps = stage.getSteps();
        stageSteps.forEach(function (step, i) {
            message += "    Step Name: " + step.getName() + "\n";
            message += "    Step Attribute: " + step.getAttribute() + "\n";
            message += "    Step Required: " + step.isRequired() + "\n";
            message += "    ---------------------------------------\n";
        });
    });
    alert(message);
}


Comments

Popular posts from this blog

Connecting Dynamics 365 Web api using external HTML page

Get azure blob files inside Sub Directories

Interview questions on MS CRM