Controlling the Lead Qualification process in CRM 2013

CRM 2013 (Orion) removed the Convert Lead dialog box from the Lead Qualification process. While migrating to the Orion instance, this is becoming a roadblock for us as the product doesn’t give the option of controlling which entity records to create upon Lead qualification.

Orion directly creates all the three entity records – Account, Contact and Opportunity as a part of lead qualification process, thus removing the flexibility from the user of selecting the entity records that needs be created. The product however checks for possible duplicates for Account and Contact records but the process isn’t favored by many and the risk of creating duplicate records or associating lead and opportunity to incorrect Account/Contact cannot be neglected.

I mentioned it as a roadblock for us because we have several business rules on lead qualification process wherein we don’t create Opportunity and Account record for a couple of qualification reasons.

In order to implement the same business rules in CRM 2013 Orion, I was researching a way to restrict the create of Opportunity/Account record for specific lead qualification status reason.

Here’s a simple way to do it –

Write a PreValidation plugin on the QualifyLead message for the Lead entity. Based on a certain condition, change the plugin context as follows

// Requirement – if the lead qualification reason is 100000021, do not create account and opportunity records
if (((OptionSetValue)(context.InputParameters["Status"])).Value == 100000021) // status is the lead qualification reason selected by the user
{
     context.InputParameters["CreateOpportunity"] = false; // set to true by default
      context.InputParameters["CreateAccount"] = false; // set to true by default
}

The InputParameters collection in the plugin context contains the key-value pairs for Account (CreateAccount), Contact (CreateContact) and Opportunity (CreateOpportunity). As shown in the above code, we can change these values to false under specific condition and hence restrict/control the unnecessary record creation.

About swaroop41

http://rockstar365.com/swaroop41

Posted on September 23, 2013, in Uncategorized and tagged , , , , . Bookmark the permalink. 18 Comments.

  1. Thanks for the code, it works great.

    one question though, after setting both CreateAccount and CreateOpportunity to false, by clicking the Qualify button on the lead form, everything happens in the background. The page stays on the lead form. Is it possible to refresh the current page and/or redirect the existing page to the newly created Contact?

  2. Hello Swaroop, This has been very helpful for us. We added a checkbox on Lead form called as “Create Opportunity” and were able to restrict creation of opportunity based on this checkbox. However when we set “create opportunity” false in the pre-validation plugin…the Lead form page does not refresh and stays in the same state (bcos of this we were able to change that qualified lead values on form and save). Is there any way to automatically refresh the page after the execution of the plugin? Thanks.

  3. Hi Jack and Sumeet,
    I dont have the setup right now, but can you guys try refreshing the page by writing a realtime workflow on the state change event of the Lead?

  4. Hi,
    After registering this plugin to lead entity, the qualify process gives error:
    “Business Process Error
    An error occurred. Contact a system administrator or refer to the Microsoft Dynamics CRM SDK troubleshooting guide.”

    I have unregistered the plugin but this error is always here when I press Qualify button. Any thoughts?

  5. I just can’t get the above code to work – CRM 2013 On Premise with Rollup 1.
    The QualifyLead message doesn’t seem to respond at all – am I missing something?

  6. Hi Swaroop,

    I don’t think we can refresh using a realtime workflow. I tried to update the same Lead once the lead status changes to qualify. but no luck. Would you please comment on this?

    Thanks in Advance..!!

  7. Hi there, i was wondering if there has being any updates on this, i am assuming that the workflow worked, please let me know, thanks!

  8. I have tried this for the ‘regular’ dynamics crm but it blows up at context.InputParameters[“CreateOpportunity”] = true; (I need true) It looks like this parameter is new to CRM 2013 (I am using CRM 2011). See also http://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.qualifyleadrequest.createopportunity(v=crm.6).aspx

  9. Thanks for the write up & code, all very informative.

  10. Hello All, I think the following blog post has a potential solution to refresh the Lead Page after Lead qualification. Hope this helps ! Thanks Ashwani Ashwin for the post.

    Modify Lead Qualification Process in Microsoft Dynamics CRM 2013

  1. Pingback: Lead Entity Changes in Dynamics CRM 2013 | Pedro Innecco

  2. Pingback: Modify Lead Qualification Process in Microsoft Dynamics CRM 2013 | Ashwani.Ashwin

  3. Pingback: Lead Entity Changes in Dynamics CRM 2013 - Microsoft Dynamics CRM Community

Leave a comment