Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 2.52 KB

File metadata and controls

57 lines (39 loc) · 2.52 KB
title description author ms.author ms.date ms.reviewer ms.topic applies_to search.audienceType contributors
setActiveStage (Client API reference) in model-driven apps| MicrosoftDocs
Sets a completed stage as the active stage.
HemantGaur
hemantg
03/12/2022
jdaly
reference
Dynamics 365 (online)
developer
JimDaly

setActiveStage (Client API reference)

[!INCLUDE./includes/setActiveStage-description.md]

Syntax

formContext.data.process.setActiveStage(stageId, callbackFunction);

[!INCLUDEcc-terminology]

Parameters

Name Type Required Description
stageId String Yes The ID of the completed stage for the table to make the active stage.
callbackFunction Function No A function to call when the operation is complete. See callbackFunction parameter

callbackFunction parameter

This callback function is passed one of the following string values to indicate the status of the operation:

Value Reason
success The operation succeeded.
invalid There are three reasons why this value may be returned:
- The stageId parameter is a non-existent stage ID value.
- The active stage isn't the selected stage.
- The record hasn't been saved yet.
unreachable The stage exists on a different path.
dirtyForm This value will be returned if the data in the page is not saved.
preventDefault This value will be returned if an OnPreStageChange event handler invokes preventDefault.

Important

This method can only be used when the selected stage and the active stage are the same. When your code is initiated from the OnStageChange event, the current stage will be selected. When your code is initiated from the OnStageSelected event, you should use the getActiveStage method to verify that the selected stage is also the active stage. For any other form event, it isn't possible to determine which stage is currently selected. For best results, this method should only be used in code that is called in functions initiated by the OnStageChange and OnStageSelected events.

Related articles

getActiveStage
formContext.data.process

[!INCLUDEfooter-include]