Dynamics 365 lets you convert a Lead into an Account, Contact and Opportunity at a click of a button. But you may not need to have an opportunity created, which means you will either need to delete these unwanted records, or just let them sit there wasting your precious space.
Well luckily enough, for these situations Dynamics 365 allows you to make a Custom ‘Qualify Lead’ using an Out-of-the-Box action called ‘Qualify Lead’. This action allows you to choose what it does while qualifying the lead. These options are shown below:
For a basic and quick no code solution you can create a real time on-demand workflow for a Lead. This will then call the action and process it with the options selected. In this example we don’t need an Opportunity so that option was set to false.
Once activated this will then show in the Ribbon on the Lead record under the Flow dropdown.
The one negative of this is that the Out-of-the-Box ribbon button for Qualifying Leads then opens up the created Opportunity. However, when using the action to throw a workflow, we cannot open up the created record. This may or may not be an issue but there is another way to qualify leads that means you can do this.
This function calls WebApi.online.execute() and passes in the generated actionRequest. It then checks the response and on success it checks that an account was created and opens that account. So the user knows something is happening we also show a loading screen while the request is taking place using Xrm.Utility.showProgressIndicator().
Another useful feature of the Qualify Lead action is the SuppressDuplicationDetection parameter. This parameter can be set to ensure that no duplicate detection rules will be applied during execution. It’s important to note that all plugins that run off create/update of a record created/updated during the execution request will, by default, have duplication detection rules applied to them. So, to ensure that no rules are applied you must set this parameter to ‘true’. If you still want these rules to apply then, either, set it to false or don’t set it at all. Just add the first line with the other object parameters and the second part the end of the getMetadata function.
If a duplicate detection rule is triggered it will trigger the on-Error call-back function, in this case displaying the alert below.
This example was just a basic implementation of a custom Lead Qualification. You can add more custom code to tailor what happens with the response to best suit your company’s needs. You can even add extra code to bring over more fields, such as custom fields on the lead, that you want applied to the newly created Account, Contact, or Opportunity.