QUESTION:
I get an HTML script error when attempting to convert a Lead via the Salesforce Lead Convert button. How can I get the error to display in a more user friendly manner, i.e. similar to how it displays when a record is blocked or redirected on insert?
ANSWER:
This is a known issue with DupeBlocker & Salesforce and occurs when a user attempts to convert a Lead and there is a matching DupeBlocker Account/Contact Scenario set to "Do Not Insert", "Redirect to Existing" or "Do Not Update". The error message is displayed as plain text, rather than displaying it properly as HTML.
There is no fix for this issue at present and Salesforce has indicated that the issue is expected behavior and referenced the following help solution:
Messages Don't Include Hyperlinks or Images when Converting Leads
Knowledge Article Number 000231464
Description
Sometimes, Salesforce administrators set triggers to display messages when you convert leads. Specifically, these triggers call the addError() method with escape=FALSE. In those triggers, administrators can include hyperlinks or images, meant to direct you to helpful content or show you images that give you better context for the message you see.
When those messages appear during lead conversion, Salesforce, however, suppresses any hyperlinks or images, just in case they include any malicious content. Instead, Salesforce displays plain text for those links and images.
Resolution When you see messages that include plain text in place of hyperlinks and images, don't worry. We're just taking precautions against any possibilities of you encountering malicious content while you convert your leads
*************************
The complete error message may look similar to this:
Error: Validation error on Account: <!-- DupeBlocker blocked this action - duplicates found. --> <div style="padding:0.7em;font-size:11px;width:40em;margin:0 auto;background-color:#FBF9EE;border-color:#FCEFA1;border-width:1px;border-style:solid;border-radius:4px;">< P align="center"><font color="black"><strong>DupeBlocker Duplicate Prevention</strong></font></P>< P align="left"><font color="red">Duplicate found based on Account Name and Phone</font><font color="black"><ul>< li align="left"><a name="db_BlockLink" href="/001C000001TWuleIAD">XYZ Inc.</a></li>< /ul></font></P></div><BR/>< script type="text/javascript">< /script><script src="/soap/ajax/31.0/connection.js" type="text/javascript"></script><script src="/soap/ajax/31.0/apex.js" type="text/javascript"></script><script type="text/javascript"> sforce.connection.sessionId = "00D80000000LHvC!AR8AQDvixe8ZZWU8GBQL_8qZ7daFnhoLTGj4DyKI_YnnoSLptgMxYBm1LC4YL0Az1d2Ya5ttNw94TgZ6udKXekBHX.XjCtNW"; sforce.apex.execute("CRMfusionDBR101/DB_WebServices","IncrementScenarioBlockCount",{scenarioId:"a2zC0000000MswbIAC", blockCount:1}, {onSuccess: doNothing, onFailure: onError} ); function doNothing(){} function onError(error){if(error.faultcode.toLowerCase()=="sf:insufficient_access"){alert("You do not have access to the DupeBlocker web services. Please contact your Salesforce administrator.\nThe configuration instructions are in the DupeBlocker install guide."); } else{alert(error.toString());} } var blockLinks = document.getElementsByName("db_BlockLink"); if ( ( location.href.toLowerCase().indexOf( "?isdtp=" ) >= 0 || location.href.toLowerCase().indexOf( "&isdtp=" ) >= 0 ) && blockLinks != null && blockLinks.length > 0 ) { for ( var linkLoop = 0; linkLoop < blockLinks.length; linkLoop ++ ) blockLinks[linkLoop].href += "?isdtp=vw"; }< /script>
Workarounds:
1. Change the "Match on Insert/Update Action" to "Report Duplicate" or "Do Nothing".
2. Disable Salesforce blocking for Lead conversions (example below if for Account duplicates, adjust accordingly for Contact duplicates):
Create two custom checkbox fields (i.e. "From Lead") on Lead and Account and have them visible only to the System Administrator profile and not on any page layout
Have the Lead field default to checked and the Account field default to unchecked
Go to the Lead field page and set up the Lead field mapping so the lead “From Lead” field is mapped to the Account “From Lead” field
When conversion happens the inserted Account will have that field checked, but Accounts created via every other method will have that field unchecked.
Then create this trigger for Accounts (be sure to update accordingly for whatever the field is actually named)
Will cause DB to create a warning for duplicate Accounts created during conversion, not block them.
trigger PreventConversionBlocking on Account ( before insert )
{
if (trigger.new.size() == 1 && trigger.new[0].From_Lead__c)
CRMfusionDBR101.DB_Api.preventBlocking();
}
Note: We've created an idea on the AppExchange and are hoping Salesforce will implement this (or something similar) which should resolve the issue. To promote better visibility, please vote for the idea: https://success.salesforce.com/ideaView?id=08730000000kzVAAAY