Thursday, July 9, 2015

Salesforce Tips and Tricks: How to Convert a Lead in Use by a Time-Based Workflow in Salesforce

Salesforce, Salesforce Tips & Tricks, Tips & Tricks

Written by Chad Smith Chad Smith

Have you ever tried to convert a Lead, only to get the “Unable to convert lead that is in use by workflow” message? Annoying isn’t it?

Fortunately, there’s a relatively easy workaround using an additional custom field, and a JavaScript button, but first why would you want to use time based workflows on leads?  One, you may want to use some drip marketing for your leads, with email messages being sent every 7, 15, days, etc., but also as reminders to your users to work the leads.  For example, email the lead owner 7 days after the lead was created if it hasn’t been converted or marked as unqualified.

1) Add a custom field like, “Cancel Time Based Workflow” to your Lead object.

2) Exclude any Lead from your workflow where that field is checked.

How to Convert a Lead in Salesforce Screenshot

Here’s the JavaScript:

{!REQUIRESCRIPT(“/soap/ajax/30.0/connection.js”)}
var newRecords = [];
var c = new sforce.SObject(“Lead”);
c.id =”{!Lead.Id}”;
c.Cancel_Time_Based_Workflow__c = “TRUE”;
newRecords.push(c);
result = sforce.connection.update(newRecords);

window.parent.location.href=”/lead/leadconvert.jsp?id={!Lead.Id}&RetURL=/{!Lead.Id}”;

Reach Out

Are you a manufacturer ready for the cloud?
Click the link below to learn how Luxent can help bring your company to the next level.

Let's Work Together
Current template: /var/www/luxent.com/www/wp-content/themes/brew-master/single.php