Requirement : While deactivating account record, we need to get deactivation comments from user 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 dialogs I suggest you to refer https://msdn.microsoft.com/en-us/library/gg509010.aspx first, where you can learn about dialogs and their component.
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. Using following steps to design our dialog:
- Navigate to Settings -> 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 on Add Step and select Page from drop down to add a page in dialog
- Select line under page and again click on Add Step and add a Prompt and Response.
- Click on Set Properties button and set properties like below :
- 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 like below and first click on Add and then on Ok, so that comment will store in description field.
- Now finally add Change Status step from Add Step dropdown and set status to Inactive
- Our dialog steps should look like below:
- Activate our dialog using Activate button on dialog command bar
Testing Dialog:
To test our dialog, now simply navigate to Sales->Accounts and select and 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 below:
Click on Next button after entering comments and finish it, it will store out comment in account record and will activate account, and you check your account record under Inactive view.
We can simply hide our of the box deactivate button using RibbonWorkbench tool, you can refer our post, for how to hide system buttons.