Sonoma Partners Microsoft CRM and Salesforce Blog

No Code Needed: Requiring Fields when Closing an Opportunity in D365

A recent requirement came up on a project to require specific fields when marking an Opportunity as Won.  The reasoning for this request is that you want your sales team to be able to quickly enter their opportunities without having to fill out a bunch of required fields.  However, you may also have specific fields that are needed upon closing the opportunity as Won, that you encourage your sales team to capture along the sales process.

At first, I thought that you could accomplish this by requiring fields in the last stage of the Business Process Flow.  Nope, that’s not the case.  Even if there are required fields in the BPF at any stage, users can go ahead and close the Opportunity as Won or Lost at any point.

Consider the Opportunity below.  Notice how Contact, Est. Close Date, Est. Revenue, and Budget Amount aren’t required.

image

However, you want this data captured before someone can mark the Opportunity as won.  You could invest in a developer and have them write a plugin to prevent save, but that would be costly.

The easy “no code” option is to use a Synchronous Workflow.  Head over the Settings –> Processes to create your new workflow.  Make sure to uncheck “Run this workflow in the background (recommended)” in order to make the workflow synchronous (or in other words, the Opportunity form won’t refresh until the workflow has run and completed).  This is key, because we’ll add a step in the workflow that will prevent the save, if our fields aren’t populated.

image

Your workflow would need to run After the “Record status changes”, and it will only need three steps:

  1. A Check Condition that will continue if the Status is set to Won.
  2. A Check Condition that will look and validate that all required fields have data.
  3. A step to stop the workflow as “Canceled” with an error message, if one of the required fields is missing data.

The overall workflow would look something like the following, along with the individual steps:

image

image

image

image

Now, when someone attempts to close an Opportunity as Won with those four fields above not populated, they’ll receive an error message as shown below.  All of this was done without a single line of code, and should the business requirements change and warrant future modifications, you can easily hop back into the workflow and make those changes quickly.

image

If you’re looking to leverage Dynamics 365 to better monitor, track, and move through Opportunities, let us know! We’d be happy to discuss your existing environment and how we might be able to help.

Contact Us

Topics: Microsoft Dynamics 365 Microsoft Dynamics CRM Microsoft Dynamics CRM Online