Tag: set business process flow using javascript

Business Process Flows – JavaScript

Microsoft Dynamics 365 and Unified Service Desk

Recently I published a post describing how to access the various components of a business process flow, including the currently active process flow, details about the stages in the process and also the steps within the stage.

Here I will build upon that post and look at what actions can be performed on a business process flow.

Get active Stage

If you need to get the name or Id of the current stage, follow code below;

var activeStage = Xrm.Page.data.process.getActiveStage();

alert(activeStage.getId());

alert(activeStage.getName());

To hide the active business Process Flow

Xrm.Page.ui.process.setVisible(false); // ** Or true

To expand or collapse the active business process flow

Xrm.Page.ui.process.setDisplayState("collapsed"); // *** Or expanded

Move to next stage in the business process

You can use the moveNext method to navigate to the next stage in the business process. As shown below;

var activeProcess = Xrm.Page.data.process.getActiveProcess; if (activeProcess != null) { Xrm.Page.data.process.moveNext(function (result) { if (result…

View original post 198 more words