+ Start a Discussion
SFDC-DMGSFDC-DMG 

Javascript Query Custom Button Error

Hello,

 

 

I keep receving the following error when I try to click on a custom button that I created on the lead record:

 

A problem with the OnClick JavaScript for this button or link was encountered:

missing ; before statement

 

 

 

I am not sure why I am getting this error. Could someone please take a look at my button code below to see if you can recognize where the error may be?

 

 

 

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}

If('{!Lead.BANT_Score__c}'=='' && '{Lead.Bant_was_logged__c' == ''){

alert("BANT must be logged before conversion to an Pre-Qualified Opportunity");
}

else
{
window.location.href="https://cs15.salesforce.com/lead/leadconvert.jsp?retURL=%2F{!Lead.Id}&id={!Lead.Id}";
}

 

 

 

Thank you!

 

Danielle

 

Vinita_SFDCVinita_SFDC

Hello Danielle,

 

In the line:

 

If('{!Lead.BANT_Score__c}'=='' && '{Lead.Bant_was_logged__c' == ''){

 

a curly barce is missing:

 

 

If('{!Lead.BANT_Score__c}'=='' && '{Lead.Bant_was_logged__c'} == ''){