MobileCRM.UI.ProcessController.changeProcess - Resconet/JSBridge GitHub Wiki

[v8.2] Changes (or clears) the business process flow for the current entity.

Arguments

Argument Type Description
processRef MobileCRM.Reference A reference to the workflow entity defining the process to use, or null to disable BusinessProcessFlow.
errorCallback function(errorMsg) The errorCallback which is called asynchronously in case of error.
scope Object The scope for callback.

This example demonstrates how to get an entity form process controller and retrieve current state information. Finally, it changes the process to visible stage.

MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
	/// <param name='entityForm' type='MobileCRM.UI.EntityForm'/>
	var processController = entityForm.getController("process");
	if (processController) {
		var info = processController.currentStateInfo;
		var activeStageRef = new MobileCRM.Reference("workflow", info.ActiveStage, info.ActiveStageName);
		var visibleStageRef = new MobileCRM.Reference("workflow", info.VisibleStage, info.VisibleStageName);
		var processId = prContr.currentStateInfo.ProcessId;
		// NOTE: null reference disables BusinessProcessFlow.
		processController.changeProcess(visibleStageRef, MobileCRM.bridge.alert, null);
	}
}, MobileCRM.bridge.alert, null);