You need to sign in to do that
Don't have an account?
Jag Singh
Lead Convert Button Code Error
Hi,
I've created a new button so that I can convert Leads when they have a Time Based workflow running. However, I'm getting an error when click the button:
"Unexpected Token ILLEGAL"
The code for my OnClick JavaScript button is:
{!REQUIRESCRIPT("/soap/ajax/20.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}”;
This happens when I actually click on the Convert button.
Thanks,
Jag
I've created a new button so that I can convert Leads when they have a Time Based workflow running. However, I'm getting an error when click the button:
"Unexpected Token ILLEGAL"
The code for my OnClick JavaScript button is:
{!REQUIRESCRIPT("/soap/ajax/20.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}”;
This happens when I actually click on the Convert button.
Thanks,
Jag
Hope this helps!
All Answers
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject("Lead");
c.id ="{!Lead.Id}";
c.!Lead.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}";
Now getting error: "Unexpected Token !"
Nearly there just needs tweaking, if anyone has any ideas that would be great!
Thanks,
J
Hope this helps!
I copied your code and this time the button actually works and moves me to the convert page of the lead. However, I thought the whole purpose was to bypass this as the error keeps appearing:
Any idea what I'm doing wrong here?
J
I've got the Lead convert to work! :)
I had another workflow on the Lead object that was also running, which I didn't delete!
Thanks for your help!
Jag