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.
Maybe it will work for you also.
How could we set condition, if condition to check the value selected in field 1 of stage 2 instead 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 per my understanding, you want to check condition of first field and then set second field required based condition, both in same stage. However, in OOB, you cannot check condition and set field value in same stage.
You will get the below OOB error if you try to do the same:
So, in this case you will probably have to go custom coding way. For this, you can refer the following blog on how to write script on BPF:
Hope this helps.
Sorry, I’m new in business process and rules, but i wonder if it is possible to have a field mandatory only in a particular stage: now if I mark a field as mandatory and I set the step with this field in a particular stage the field is required independently of the current stage…
Yes, it is possible to set the field mandatory in one stage and optional in another stage. For example, In the First Stage Purchase Timeframe field is optional (untick), which means you can move ahead to Stage 2 without filling it.
In Stage 2, the same field is set to be required. Now, you cannot finish the process without filling it.
Hope this helps