Customization of Opportunity Close dialog box in Dynamics 365

By | August 7, 2019

Introduction:

Earlier to the Wave 2 release there was no option to customize the Opportunity Close dialog box. While closing an opportunity, organization would like to know why the opportunity is lost or won. If it is lost then business will try new strategies to improve win rates.

In this Wave 2 release Microsoft has provided supporting customization of the Opportunity Close dialog box, which helps Sales organization to track the close/win details based on their strategic sales initiatives.

Let’s take a scenario where business wants to add field on Opportunity Close dialog box like Outsource Vendors etc. To add fields, navigate to Settings–>Customization–>Customize the System and choose entity Opportunity Close and open the form as shown below and add Opportunity Vendor field.

So let’s see the Opportunity Close dialog box after adding the field.

To customize the Opportunity Close dialog box you need to enable the setting, then you will be able to customize the form of Opportunity Close entity by following the below steps:

Navigate to Settings–>Administration, select System Settings.

In the System Settings dialog box, on the Sales tab, set the Customize close opportunity form field to Yes as shown below:

Now organization wants to show and hide the fields based on the Opportunity Close and Opportunity Won. The business required, if opportunity won then Outsource Vendor field will be shown and if Opportunity lost then Competitor field will be visible and the user will not be able to see the Outsource vendor field.

Now we have tried to show and hide fields based on the condition using Business rules but Opportunity Vendor field is not present in the list. It may seem like it is a bug.

Next, we used the JavaScript and it is working. We added JavaScript on load of Opportunity Close form.

Here in JavaScript, we wrote a code where if user clicks on Close as won button then user will be able to see the Outsource Vendor field and won’t be able to see the Competitor field.

If user clicks on Close as Lost then user can see the Competitor field but won’t be able to see the Outsource Vendor field as shown below:

By enabling customization to Opportunity Close dialog box, it now also allows you to add additional forms, however creating a new Quick Create form instead of customizing the existing one does not work. It will show up the new form when you click Close as Won or Lost but it will not pre-populate the opportunity details or the state/status reason box. It is therefore important to customize the existing form. The same work is invoked for both Close as Won and Close as Lost scenarios.

As you can see below the new form created for Opportunity Close dialog box does not populate the data of Status Reason:

Conclusion:

Editable Opportunity Close dialog box helps organizations to track whether the competitors are trending in losses, or what drove success in wins.

Cut short 90% of your manual work and repetitive data entry!

Get 1 Click apps and say goodbye to all repetitive data entry in CRM –
Click2Clone – Clone/Copy Dynamics 365 CRM records in 1 Click
Click2Export – Export Dynamics 365 CRM Report/CRM Views/Word/Excel template in 1 Click
Click2Undo – Undo & Restore Dynamics 365 CRM data in 1 Click

2 thoughts on “Customization of Opportunity Close dialog box in Dynamics 365

    1. Inogic

      Thats the normal api script that we write to show/hide the fields on forms. you need to write the below code on the opportunity close form

      //validate executionContext
      if (executionContext.getFormContext() !== null && executionContext.getFormContext() !== “undefined”) {
      //get formContext
      var formContext = executionContext.getFormContext();
      //get Opportunity Status
      var stateCode = formContext.getAttribute(“opportunitystatecode”).getValue();

      //If won then show ” Outsource Vendors ” and hide “Competitor”
      if(stateCode == 1){
      formContext.getControl(“partners”).setVisible(true);
      formContext.getControl(“competitorid”).setVisible(false);

      }
      else{
      formContext.getControl(“partners”).setVisible(false);
      ormContext.getControl(“competitorid”).setVisible(true);
      }
      }

Comments are closed.