Get Comment From User Before De-activating Entity Record In Microsoft Dynamics CRM

Requirement

While deactivating account record, we need to prompt user to entering comments, before deactivating account.

Solution

We can implement this requirement using different ways, in this post we are going to provide out of the box solution for this requirement. We can achieve this using dialog. If you are new to dialog, I suggest you to refer this KB first, where you can learn about dialog and their components.

Idea here is hide the out of the box deactivate button for account entity and then design a dialog with prompt and response, we can ask user to enter comments and then we can update account entity description field (or you can setup your own custom field) with the comments, after that we can deactivate account record. Use the following steps to design our dialog:

  • Navigate to Settings, then Processes and select New button through process command bar.

  • Enter process name, for example “Deactivate Account”.

  • Select category as “Dialog” and select Account under entity drop down.

  • Click Add Step and select Page from the drop down to add a page in dialog.

    Add Step

  • Select line under page and again click on Add Step and add a Prompt and Response.

  • Click on Set Properties button and set properties as in the following screenshot:

    Set Properties

  • Click on Save and Close and select Page area and then add Update from Add Step dropdown, now we will update account record.

  • Click on Set Properties, select description field in account form and select Look For as in the following screenshot and first click on Add and then on OK, so that comment will store in description field.

    description field

  • Now finally add Change Status step from Add Step dropdown and set status to Inactive.

  • Our dialog steps should look like the following:

    dialog

  • Activate dialog using Activate button on dialog command bar.

Testing Dialog

To test our dialog, now simply navigate to Sales, then Accounts and select an account and click on Start Dialog button under more commands (…), it will display our dialog name, select our dialog and click on Add, it will ask for comment like the following:

comment

Click Next button after entering comments and finish it, it will store comment under description field in account record and will activate account, and you check your account record under Inactive view.

We can simply hide our out of the deactivate command button using RibbonWorkbench tool, you can refer our earlier article for how to hide system buttons.