Article published on the 15th of August, 2023.
The ability to create stage models to manage and facilitate the life-cycles of entities such as projects, cases, or contracts is an important feature of WorkPoint. Tracking a project's, case's, or contract's stages ensures transparency, accountability, and informed decision-making, while also facilitating early risk detection and mitigation, leading to successful and efficient outcomes.
Using WorkPoint Automate, you can configure the functionality for changing the stages of your entities in WorkPoint.
Configurations can range from simple two step processes where the user simply selects a stage and lets the system change the stage, to more complex setups which additionally allows the user to modify meta data, send notifications, and more in the same process.
In this article, we will provide some examples of processes which could be used as-is, or serve as inspiration for your own process design.
2.1. Simple Change Stage Process
In this example, we will create a simple process which users can start from the My Tools panel of an entity, the Stage Band of an entity.
We will be using the following two types of steps:
- Stage form
- Change stage
This process is designed to be usable on any business module in our WorkPoint solution which uses stage management.
For this purpose, we have created a new process titled "Simple Change Stage":
First, we add a Stage form step:
Note that we have changed some of the settings in the General tab, namely the step title and the description is set to the following adaptive expression:
"Select the new stage for your " + BusinessModule.EntityName + "."
Additionally, we have set the title for the Continue button on the step to "Change stage".
In the "Options" tab, we set up the following configuration:
Note that in this example, we are not utilizing multiple stage model, so "Allow stage model transition" is set to "No".
Next, we add a Change stage step:
Here, we have added the following adaptive expression for the description field:
"Changes the stage of " + Entity.Title + "."
In the "Options" tab, we have set up the following configuration:
With this process configuration, we are able to change the stage of any entity when located on the entity site, using either a button in the My Tools panel, or the Change stage button in the Stage band.
Note that for this demonstration, we have created a My Tools button to run the Simple Change Stage process. We have also set the process as the default change stage process for the Projects business module on our solution.
Running the process from My Tools
Running the process from the Stage Band
2.2. Skip Stage form if run from Stage Band
In this example, we will expand on the Simple Change Stage process from the previous example.
We will make it so that the Stage form is only shown to the user if they run the process from the My Tools panel. If the process is instead run from the Stage Band, we will skip the step (since the user has already selected the target stage in the Stage Band itself).
Before we can do so, we need to understand an important point about when a process is started from the "Go to stage" button in the Stage Band. When this happens, the ID of the stage that the user selected in the Stage Band is automatically saved into the context of the process which is started. This ID is saved into the "Parameters" context object. This is useful, because we can use this information to detect whether the process was started from the stage band (if "Parameters.StageId" is not empty), or from the My Tools panel (if "Parameters.StageId" is empty).
For the purpose of this example, we need the following:
- A "Before execution" rule on the Stage form step which skips the step if "Parameters.StageId" is not empty.
- An expression on the "Stage ID" field on the Chance stage step which ensures that if "Parameters.StageId" if not empty then use that parameter as Stage ID, and if it is empty then use the Stage ID from the Stage form.
Let's start by creating the Before execution rule on the Stage form:
- In the "Rules" tab of the Stage form, we click the "+ Before execution" button to add a new Before execution rule.
- In the "Action" field, we select "Skip".
- In the "Condition(s)" field, we type the following adaptive expression:
With this configuration, the Stage form will be skipped if the "StageId" variable in the "Parameters" list in the process context is not empty, i.e. if the user starts the process from the Stage Band. If not, the Stage form will be presented to the user which can proceed to select a stage and continue.
Next, we need to specify how the Change stage step should behave depending on how the process was started:
- If the process was started from the Stage Band, the Change stage step should use the value from "Parameters.StageId" in the Stage ID field as target stage.
- If the process was started from a button in the My Tools panel, the Change stage step should use the stage selected in the Stage form as target stage.
We can implement this behaviour by using an adaptive expression on the "Stage ID" field on the Change stage step:
- In the Options tab on the Change stage step, we remove the configuration in the "Stage ID" field and instead click "Advanced" to add an adaptive expression to the field.
In the Advanced view, we add the following adaptive expression:
if(!empty(Parameters.StageId), Parameters.StageId, ChangeStageForm.stage)
With this adaptive expression, we tell the Stage ID field to check if Parameters.StageId contains data, i.e. a stage id. If Parameters.StageId contains a stage id, then we use that as the target stage. If Parameters.StageId does not contain data, we use the stage selected in the Stage form as target stage.
For the demonstration if the edits we made in this example, we still have the same My Tools button and Stage Band as in the previous example. Only this time, if the user runs the process from the My Tools panel, the user needs to select a target stage in the Stage form. If they run the process from the Stage Band, the Stage form will be skipped, and the entity will change to the stage selected in the Stage Band: