You need to sign in to do that
Don't have an account?
XVL
I am trying to create a work flow on a lead that will alert an owner when the lead has been in "Working" status for more than 14 days.
I am trying to create a work flow on a lead that will alert an owner when the lead has been in "Working" status for more than 14 days. At this point, the system should create a task. I have created a date field that tracks the date. I have tried using a formula to count the number of days and set the workflow criteria o 14. That did not work. I have also tried using a custom field that updates with todays date when the lead is changed to working. But, nothing seemes to work. I know about time based workflows, but I can't "build" on my previous worklow, but doing that prevents the lead from being able to be converted.
I found a solution that seems to work quite well in my test.
http://www.opfocus.com/blog/how-to-convert-a-lead-in-use-by-a-time-based-workflow-in-salesforce/
1. Add a new checkbox field
Create a checkbox field named Cancel Workflow to the Lead object. By default, the checkbox is unchecked. The field doesn’t need to appear on the page layout.
2. Edit Your Workflow Rule
Change your workflow rule to add “Cancel Workflow equals False” to the criteria. In other words, if the new checkbox becomes checked, the Lead will no longer meet the workflow criteria.
3. Create a Visualforce page like this:
<apex:page standardController="Lead" >
<apex:form>
<div style="visibility:hidden;">
<apex:inputField value="{!Lead.Cancel_Workflow__c}" id="cancelWorkflow" style="visibility:hidden; "/>
</div>
<apex:actionFunction name="quickSave" action="{!quickSave}" oncomplete="standardConvert();"/>
<apex:actionFunction name="standardConvert"
action="{!URLFOR($Action.Lead.Convert, lead.id, [retURL=$CurrentPage.parameters.retURL], true)}" />
<script language="JavaScript">
var previousOnload = window.onload;
window.onload = function() {
if (previousOnload) previousOnload();
fixLead();
}
function fixLead() {
var elemCancelWorkflow = document.getElementById('{!$Component.cancelWorkflow}');
elemCancelWorkflow.checked = true;
quickSave();
}
</script>
</apex:form>
</apex:page>
4. Override Lead Object’s Standard Convert Action
Override the Lead object’s standard Convert action with the new Visualforce page. (Use Setup | Customize | Leads | Buttons and Links, then click Edit next to the Convert link to get to the override page.)
With this in place, when you click the Lead’s Convert button, you’ll see a brief flicker as this page is loaded and does its work, but the page will then redirect to the standard Lead Convert page. By the time you get there, the Lead will have been removed from the workflow queue, and you’ll be free to convert the Lead.
All Answers
You can achieve this with time based workflow only. You can deactivate previous WF and create new time based wf. Regarding preventing leads from being converted, can you check debug logs for what error do you get on converting lead.
Refer: https://help.salesforce.com/HTViewSolution?id=000005245&language=en_US
I found a solution that seems to work quite well in my test.
http://www.opfocus.com/blog/how-to-convert-a-lead-in-use-by-a-time-based-workflow-in-salesforce/
1. Add a new checkbox field
Create a checkbox field named Cancel Workflow to the Lead object. By default, the checkbox is unchecked. The field doesn’t need to appear on the page layout.
2. Edit Your Workflow Rule
Change your workflow rule to add “Cancel Workflow equals False” to the criteria. In other words, if the new checkbox becomes checked, the Lead will no longer meet the workflow criteria.
3. Create a Visualforce page like this:
<apex:page standardController="Lead" >
<apex:form>
<div style="visibility:hidden;">
<apex:inputField value="{!Lead.Cancel_Workflow__c}" id="cancelWorkflow" style="visibility:hidden; "/>
</div>
<apex:actionFunction name="quickSave" action="{!quickSave}" oncomplete="standardConvert();"/>
<apex:actionFunction name="standardConvert"
action="{!URLFOR($Action.Lead.Convert, lead.id, [retURL=$CurrentPage.parameters.retURL], true)}" />
<script language="JavaScript">
var previousOnload = window.onload;
window.onload = function() {
if (previousOnload) previousOnload();
fixLead();
}
function fixLead() {
var elemCancelWorkflow = document.getElementById('{!$Component.cancelWorkflow}');
elemCancelWorkflow.checked = true;
quickSave();
}
</script>
</apex:form>
</apex:page>
4. Override Lead Object’s Standard Convert Action
Override the Lead object’s standard Convert action with the new Visualforce page. (Use Setup | Customize | Leads | Buttons and Links, then click Edit next to the Convert link to get to the override page.)
With this in place, when you click the Lead’s Convert button, you’ll see a brief flicker as this page is loaded and does its work, but the page will then redirect to the standard Lead Convert page. By the time you get there, the Lead will have been removed from the workflow queue, and you’ll be free to convert the Lead.
Thanks in advance!
Cheers
Trevor