This is another technical post inspired by a recent customer need. It covers how to use Microsoft Dynamics CRM Dialogs to implement a specific business process.
In this scenario, we have Accounts that get placed On Hold by a business process that cannot be corrected. A user is then given the authority override the On Hold status so other business processes can proceed. In our example, there are two fields that are read-only on the Account entity: Override (Yes/No) and Override Description (Text box). When the override process occurs, the Override field is set and the reason is recorded in the Override Description. Finally, the Account status will be changed to Active.
First let’s create our Dialog. Begin by clicking on Settings then Processes and then clicking on the new button.
Set the Process Name, select Account for the entity and select Dialog for the Category. Then click OK.
In the next screen, ensure that the As an on-demand process is left checked. Click on the Select this row and click Add Step, and from the Add Step drop-down, select Page. Type a name for the description, then click on the Select this row and click Add Step below the Page, and from the Add Step drop-down, select Prompt and Response. Click the Set Properties button. A Define Prompt and Response window will be displayed. Set the Statement Label and enter a Prompt Text. In the Response Details select Multiple Lines (Text Only) from the Response Type drop-down.
Click Save and Close.
Select the Page block, then click on the Add Step and choose Update Record.
Click on the Set Properties button. As you can, see we have a small problem. Because the Override and Override Reason fields are read-only you cannot select values from the right to set these fields.
There are two workarounds for this. The easiest is to save the Dialog and then modify the Account form and make the Override and Override Description fields not read only then Save and Publish. Reopen the Dialog and you will now be able to set Override and Override Description fields.
Save the Dialog and then modify the Account form and set the Override and Override Description fields back to read only then Save and Publish.
The other workaround is to write a custom workflow that will receive the Response Text (Override Reason) as an Input Parameter and set the Override flag and Override Description in code.
Once we have the Override and Override Description fields set, we will then set the Status of the Account to Active. Click on Add Step and choose Change Status. Set the Status Reason to Active. Finally, add a Stop Dialog step.
The Dialog should look like this:
You then Activate the Dialog, making it ready for use. Now, if an Account that is placed On Hold, the user can click on the Dialog button and select the Override Dialog.
When the Dialog finishes, the Override and Override Description will be set and the status will be changed. You can check the status of the Dialog by clicking on the Dialog Status link under Processes and open the Dialog Session record.
You can then either Close and Reopen the Account record or you can press F5 to refresh the record to see the changes.
Now that the Account is Active, other business processes can continue.
That’s it! So how do you use dialogs to automate business processes in Dynamics CRM?