One of the exciting new features of Microsoft Dynamics CRM 2013 is Business Process Flows. This feature provides many benefits including:

  • A business process flow guides new and existing users throughout the stages (e.g. qualify, develop, propose, etc.) in a process (e.g. sales, service, etc.)
  • A business process flow can span multiple entities
  • A business process flow ensures required fields are populated before proceeding to the next step
    • Note: Required fields (steps) in the business process flow are independent of the form save
  • Business process flows can be defined by security role
  • Multiple business process flows can be defined for one entity. The user can choose which process to use
    • Note: You can automatically select the business process by following the step outlined in Scott Durow’s blog

After using this feature, I was left with a few questions.

  1. While configuring each step, the configuration options are limited. You can only change the field/stage label and set the requirement level. For example: If my step contains a lookup field, how can I configure the default view? If the lookup field is located in the form body, this can be accomplished very easily. It is not straight forward when the field is located in the process flow header
  2. Can you configure a conditionally required field/step?
  3. How can you display the progress of your business process in a view?

Set the Default View for a Business Process Flow Step/Field

For the following example, let’s say you want to configure the opportunity’s account field to use a custom default view named Active Customer Accounts. Configuring this on the form is easy. You simply 1) open the form editor, 2) double click on the “Account” field, and 3) select the new view.

CRM Blog_Campbell_Working w BP Flows 1

However, this change does not affect the corresponding field/stage in the business process flow. The business process flow stage still uses the Account Lookup View.

CRM Blog_Campbell_Working w BP Flows 2

To set the default view in the business process flow, you must use JavaScript. All the controls in the business process flow header are prefixed with header_process_. Therefore, you can access the control using the Xrm.Page API. For example, the following code snippet will retrieve the Identify Account control.

Xrm.Page.getControl (“header_process_parentaccountid”);

To set the header’s default view to the form’s default view, add the following JavaScript to the onload event of the form.

var defaultView = Xrm.Page.getControl (“parentaccountid”) .getDefaultView();

Xrm.Page.getControl (“header_process_parentaccountid”) .setDefaultView(defaultView);

Conditionally Require a Business Process Flow Step/Field?

Making a step required is as simple as checking a box. Unfortunately, I do not believe you can make a step conditionally required without complex JavaScript.

CRM Blog_Campbell_Working w BP Flows 3

If you want to make a field conditionally required on the form, you can utilize CRM’s new Business Rules feature or write JavaScript using the Xrm.Page API. Since the business rules cannot access a control in the process flow header, you cannot use the Business Rules feature to achieve this functionality. The next logical thought is to use JavaScript – especially since we accessed the control in the previous example.

Xrm.Page.getControl (“header_process_parentaccountid”) .setRequiredLevel (“required”);

Using the code above, the form has unexpected behavior. The step becomes required when saving the form. Normally, a required step does not restrict the form from saving. Also, if you click the Next Step button twice, you can move the process forward without filling in the required field/step.

As a rule of thumb, you should move the business logic (e.g. conditionally required fields, conditionally visible fields, etc.) from the business process flow to the form. The business process flow should be viewed as a categorized checklist.

Add the Business Process Flow to a View

Dynamics CRM Tip of the Day #46 states only one tracking method should be utilized – either the “old” sales stage field or the new business process flow. The blog provides several valid arguments for the stance. If you opt for business process flows, you may want to add the process and current stage/step into your views. When an entity is enabled for business process flows, two fields are automatically added to entity: 1) processid and 2) stageid. When these two fields are added to a view, only the GUIDs are displayed.

CRM Blog_Campbell_Working w BP Flows 4

Instead of selecting the processid or stageid fields, select the Process Stage (Process Stage) record type. Using the Process Stage record, you have the option of selecting the Process Stage Name field or Stage Category field.

CRM Blog_Campbell_Working w BP Flows 5

Unfortunately, the process name (e.g. Opportunity Sales Process) cannot be displayed in the view since it is related to the Process Stage record. This is only a concern if your organization has multiple business process flows defined for the same entity. However, you can include the process in the view’s filtering criteria:

CRM Blog_Campbell_Working w BP Flows 6

If you need troubleshooting support for Microsoft Dynamics CRM 2013, McGladrey offers a full range of services from implementation and optimization to development and support. Contact our professionals for more information on our services at 855.437.7202 or crm@mcgladrey.com.

Read more articles on the new release of Microsoft Dynamics CRM 2013.

By Stephen Campbell – Microsoft Dynamics CRM partner in New Jersey

The post Working with Business Process Flows in Microsoft Dynamics CRM 2013 appeared first on Microsoft Dynamics CRM Professionals.