Update field value based on the current stage of Business Process Flow and trigger workflow when Business Process Flow is finished.
Introduction:
This blog explains
- How to Update field value based on the current stage of Business Process Flow.
- How to Trigger workflow when Business Process Flow is finished.
PART A:
Scenario:
We have a custom Business Process Flow with 4 stages on Order entity. Whenever user changes the stage of Business Process Flow status field is updated. (we have created custom status field named as printing status).
Steps to be followed:
1. Create Real time Workflow on Business Process Flow Entity.
2. Trigger workflow on Process Changes:
3. Add Step –> Update Record.
Update the field value with active BPF stage.
4. Create another real time workflow on Order entity.
5. Trigger on Record Field Change and select the field where you are updating the stage value.
6. Add Step –> Check Condition and Update the field value. (check the stage field value and update the status accordingly )
For example first stage in BPF is waiting for jersey then we will check if Current stage is equal to waiting for jersey then update the printing status to waiting for jersey.
Complete Workflow:
PART B: How to Trigger workflow when Business Process Flow is finished.
Scenario:
Update the Order Status to fulfilled when Business Process Flow is finished.
Steps to be followed:
1. Create a Real time and on demand workflow on Order entity.
2. Add Step -> Change Status to complete
3. Activate the workflow.
4. Go to Business Process flow which you are using and perform the below steps:
a. Drag and Drop the workflow in Global Workflow.
b. Trigger the workflow on when process is completed and select the workflow which you have created. (you will only see on demand workflows)