Recently, I was asked to implement a process where a Lead could be converted to a Contact, without creating an Opportunity.While there may have been options to do this via custom code, I wanted to do this leveraging configuration.
While we cannot bypass the Opportunity creation process, and we will be forced to open a newly created Opportunity, the steps below will assist you in either automatically cancelling, or deleting, the Opportunity.
It should be noted, although the build-out below only leverages configuration, it does require the Dynamics 365 Workflow Tools to be installed in your environment. This solution can be downloaded here: https://github.com/demianrasko/Dynamics-365-Workflow-Tools The reason for this tool is if you want to delete the Opportunity created in this standard process. If you wish to cancel the Opportunity, this tool will not be needed. See Step 03 below for additional insight.
Step 01: In your solution, on both the Lead and Opportunity entities, create a two-option (Yes/No) field called Skip Opportunity. Depending on how your organization would like to interact with this field, either expose it on the Lead form, or a related Business Process Flow for Lead. This will allow users, at the Lead level, to mark this Skip Opportunity field as Yes, if they do not want an Opportunity in the system after the qualification occurs. My intent is for users to engage with this field at the Lead level only, even though the field exists at the Opportunity level.
Step 02: From the Lead entity in your solution, select the 1:N Relationships. Locate the relationship where Schema Name is opportunity_originating_lead, Primary Entity is Lead, Related Entity is Opportunity, and Field Name is Originating Lead. Open this relationship. With the relationship open, select Mappings from the left-hand side and select New. Map your Skip Opportunity from Lead to Opportunity and click OK. Save and Close the relationship window to return back to the solution.
The next tasks will be creating a series of two workflows, one of which will validate whether Opportunity field Skip Opportunity equals Yes and update Status, and another workflow to delete the Opportunity. If you do not want to delete the Opportunity, and only wish to deactivate, I will provide this information as well.
Step 03: If you wish to only cancel the Opportunity, skip this step and go directly to step 04! If you would like to delete the Opportunity, continue with this step. Create a background workflow for Opportunity, I’ve called this Skip Opportunity – Delete. I have configured this as a child process with the following settings:
The logic for this workflow:
Step 04: Create a real-time workflow for Opportunity, I’ve called this Skip Opportunity. I have configured this with the setting captured below. The Record fields change is set to only the Skip Opportunity field.
The logic for this workflow is below. If you are only wanting to cancel the Opportunity, you can skip calling the workflow created in step 03 – Only create the workflow with the Change record status logic.
The user experience on this will be to set Skip Opportunity on a Lead equal to Yes, then qualify the Lead. This will then open the newly created Opportunity. If the workflows are set-up correctly, the Opportunity will be cancelled, and Skip Opportunity will be set to Yes. If you implemented the deletion in step 3, the Opportunity should be deleted after 1 minute.
Note: While the above scenario is how I configured this, you can update a number of things such as field names, workflow names, workflow timeout limits, etc… As always, configure this in your test/development company before implementing in production.