Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications

|

How to Set a Read-Only Field and Capture a User’s Response Using a Dialog

Post Author: Joe D365 |

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.

The first step is to create a dialog

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.

How to Set a Read-Only Field and Capture a User’s Response Using a Dialog

Click Save and Close.

Select the Page block, then click on the Add Step and choose Update Record.

How to Set a Read-Only Field and Capture a User’s Response Using a Dialog

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.

How to Set a Read-Only Field and Capture a User’s Response Using a Dialog

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.

How to Set a Read-Only Field and Capture a User’s Response Using a Dialog

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:

How to Set a Read-Only Field and Capture a User’s Response Using a Dialog

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.

How to Set a Read-Only Field and Capture a User’s Response Using a 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.

How to Set a Read-Only Field and Capture a User’s Response Using a Dialog

You can then either Close and Reopen the Account record or you can press F5 to refresh the record to see the changes.

How to Set a Read-Only Field and Capture a User’s Response Using a Dialog

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?

Happy CRM'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends