Sitecore Box

Sitecore web developer at Americaneagle.com

Sitecore Content Hub: CMP Conditional State Flow


 

With Sitecore Content Hub, there are built-in state flows. Also, you can create your own state flow based on your organizational structure by extending the CMP state flows as you can see in this link.

 
This blog guides you on creating a custom conditional state flow. Let's say we want to implement a state flow similar to the below one, where we have a checkbox field on a specific entity and the next state depends on that field's value, if the checkbox is checked then the next state will be "Second review", if it is unchecked then the next state will be "Manager check":


To Implement the above flow we need to do something out of the box. We need to use Trigger, Action, and Script.

First, we need to create a script to override the next state. Please check this link to know how to create a script.

Here is the script body:


After we create the script we need to create an action of action script type and then you need to select the script you created above in the "script" field for this action. Please this link to create a custom action.




This action should be triggered by a custom trigger. Please follow the instructions in this link to create a trigger.

In the conditions tab, you need to configure the conditions as you can see in the below image. These conditions mean that the trigger will be executed if the state has changed and if the next state is a specific state which is in our case is the "second review" state. In the actions tab, you need to select the action you created above.



Going back to the script, in order to get the ID for a specific state, you can change the condition in the trigger to be executed if the active state is the one that you need to get its ID, and then you need use the log to get that ID.

0 comments:

Post a Comment