Customize Opportunity Close Dialog Box

By - December 4, 2019

After the October 2019 release wave, system administrators now have the ability to customize/configure the Opportunity Close Dialog box without having to use any code or other development efforts. This is a great new feature and allows us to capture additional information when an opportunity is closed, either won or lost. In the following example I am going to add a custom ‘Other Reason’ text field that only shows (and becomes required) if users close an opportunity as lost, and if a status reason of ‘other’ was selected. If a different status reason is selected, the field is hidden and not required.

Configuration

The first thing we need to do it make sure the instance has been upgraded to the October 2019 release wave 2. You can check this by navigating to https://admin.powerplatform.microsoft.com/environments, then click on the environment you are working in. You will see if the environment has been upgraded on the left hand side of the screen. If your environment hasn’t been upgraded, you can start the process from here. Make sure you try this in a sandbox environment first.

Once you have confirmed the instance has the 2019 release wave updates installed, you will need to turn on the ability to configure the opportunity close dialog box. Open your D365 CE instance and click on the gear icon in the top right corner, then click on ‘Advanced Settings’, click on the Settings tile again, select ‘Administration’ > System Settings; click on the ‘Sales’ tab and set the ‘Customize close opportunity form’ to ‘Yes’.

The first thing we’re going to do is add the ‘Other’ value to the opportunity status reason field. As of today we cannot make changes to values of the status code fields in the new configuration area, so we’re going to make these changes using the classic experience.

In your Dynamics 365 CE instance navigate to Settings > Customizations > click Customize the System to open the default solution. Expand the entities by clicking on the chevron next to ‘Entities’ and scroll down to the opportunity entity. Click the chevron to expand the opportunity entity and click on ‘Fields’. Locate the Status Reason (StatusCode) field and double click to open it. Under ‘Type’, change the Status field to ‘Lost’, as we only want users to be able to pick ‘Other’ as a reason when an opportunity is lost. Click the ‘Add’ button on the left side of the form and add the ‘Other’ value to the field. Take note of the value that is automatically assigned (in my case 100000) as we will reference this value later. Click ‘Save & Close’ and publish your changes.

We also need to add this option to the opportunitystatuscode field (Status Reason) of the Opportunity Close entity. In the default solution, expand the opportunity close entity and click on fields. Search for opportunitystatuscode (schema name) field and double click to open it. Under ‘Options’ click the green + button to add an option. Click on the newly added item and change the label to ‘Other Reason’.

The most important step here is to set this value to the same value that was assigned when we added an item to the opportunity status reason option set, which in my example was 100000. If you don’t do this, the value won’t be available for selection when using the opportunity close form!!

In the next step we’re going to add a text field called ‘Reason’ to the opportunity close (quick create) form where people can type in the reason the opportunity was lost.
Expand the Opportunity Close entity and click on ‘fields’. Create a new text field called ‘Reason’, click ‘Save & Close’ to create the field. Now go to forms and open the ‘Opportunity Close’ quick create form and drag the newly created field on the form. (I put it under the ‘Status Reason’ field)
I only want to show the ‘Reason’ field (and make it required) when the status reason ‘Other Reason’ is selected, so I am going to add a business rule as well. click ‘Save and Close’ to close the form and publish your changes.

Business Rule Configuration

Navigate to Business Rules under the Opportunity Close entity in the default solution. Click ‘New’ on the mini ribbon and name your business rule appropriately. Scope (top right) ‘All Forms’.
Configure the condition: Field: ‘Status Reason’ ‘equals’ ‘Other Reason’.
Now drag the Set Visibility component to the area next to the check box(This is the ‘If True’ condition). Also drag a ‘Set Visibility’ component to the area next to the X (If False). For the ‘If True’ Condition, under ‘Visibility’, select ‘Reason’ and set ‘Visible’ to ‘Yes’. For the ‘If False’ condition, configure the ‘Set Visibility’ component using the same field, but set visible to ‘No’. Now add the ‘Set Business Required’ component to both conditions. For the ‘If True’ condition, select the ‘Reason’ field and set status to ‘Business Required’. For the ‘If False’ condition, configure the same field and set the status to ‘Not Business Required’. Save and activate your business rule and test your configuration.

I hope you enjoyed this post! Be sure to check in again next week for a new article!

This article was originally posted on https://d365goddess.com/customize-opportunity-close-dialog-box/

 

Dian Taylor is a Microsoft Business Applications MVP and a LinkedIn Learning Author. She works at RSM as a Dynamics 365 (CRM) Presales Director. Dian is a seasoned pre-sales consultant specializing in Microsoft Dynamics 365 Customer Engagement since 2011. In the past Dian has been involved in solution designing, implementing, configuring and customizing several complex scenarios in various industry sectors. D365-CE modules: Sales, Sales Insights, Custer Service, Omnichannel for Customer Service, Field Service, Project Service Automation, Project Operations. Power Platform: Power Automate, Power Virtual Agents Website: https://d365goddess.com YouTube: https://youtube.com/d365goddess Twitter: @D365Goddess

Receive Posts by Email

Subscribe and receive notifications of new posts by email.