Make the Business Process Flow fields to be required conditionally

By | August 30, 2017

Introduction:

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.

First, we tried to achieve this by writing a client side JavaScript code to make the Business Process fields required based on the value selected in particular field.

But JavaScript won’t work! We tried to use ‘setRequiredLevel’, but this method doesn’t work for the fields present in the Business Process Flow even though we use ‘header_process_’ to get the fields.

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;

Make the Business Process Flow fields to be required conditionallyHere, 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.

Make the Business Process Flow fields to be required conditionally

Note:

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.

Integrate Intuit QuickBooks & Microsoft Dynamics 365 with InoLink

Leave a Reply