Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

CRM Online 2015 - Lead Qualify Conditional Page Refresh

$
0
0

Hi,

I have a plugin that triggers on lead qualify. It will conditionally set the lead to not create an opportunity based on the status selected when qualifying.

If CType(plugin.Context.InputParameters("Status"), OptionSetValue).Value = OptionSets.lead_statuscode.OpenOppExists Then
   plugin.Context.InputParameters("CreateOpportunity") = False '// set to true by default
End If


This worked, with the exception that the page would not refresh when the opportunity was not created. So I found some javascript code that would refresh the page on a qualify during the form onSave event.

function refreshOnQualify(pContext) {
   var lintSaveMode;
   var lintSaveEventVal;

   // Change the Save Event Value as per required Save Event
   lintSaveEventVal = 16;

   if (pContext != null && pContext.getEventArgs() != null) {
      lintSaveMode = pContext.getEventArgs().getSaveMode();

      // 16 will pass on Lead Qualify button click
      if (lintSaveMode == lintSaveEventVal) {
         setTimeout(function () {
            window.location.reload(true);
            window.top.parent.document.location.reload(true);

         }, 1000);
      }
   }
}


This worked when an opportunity wasn't created. However, when an opportunity is created, it refreshes the page, and does not direct the user to the created opportunity.

I haven't been able to find way to capture what status the lead is being qualified with. Is there a way to refresh the page based on which status is being used to qualify the lead?


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>