Recently, we had a business requirement to make some fields, present in the Business process flow stage, to be required conditionally based on the value selected in one of the fields in the BPF stage.
Using the Branching functionality of Business Process Flow:
Finally, we decided to use the branching functionality of BPF which was introduced in Dynamics CRM 2015.
The logic is to have two stages with the same structure. The only difference would be that one stage will have the fields as required & another stage will have the fields as optional and switch these stages based on the value selected in the particular field.
We have a condition to check the value selected in field 1 of stage 1. If the field value is true then show Stage2 with Field 2 as required else show Stage 2 with Field 2 as optional, as seen in the image below;
Here, we have two stages for Stage 2. Everything will be a same, i.e., the name of the stage, number of fields, etc. except one will have the field as required and other will have the field as optional.
Below is the example of the Business Process flow designer where you can see that we are conditionally showing the same stages but with different field requirement levels.
To create the same stage we just copied the stage.
Each stage in the BPF has their own unique GUID. So in the above case where we have two same stages, the stage name would be the same, but the GUID of two stages would be different.