+ Start a Discussion
Del_SantosDel_Santos 

Help with Javascript

Hi,

 

I have a custom button with below javascript, however it is prompting me error: "Yes is not defined"

please help.

 

===============

 

if( {!Quote.With_Concesssion__c} == "Yes" ) 

window.open('http://www.yahoo.com'); 

else 

window.open('http://www.google.com'); 
}

 

 

 

Thanks,

Del

Best Answer chosen by Admin (Salesforce Developers) 
Avidev9Avidev9

You just need to tweak your code

 

if( "{!Quote.With_Concesssion__c}" == "Yes" ) 

 (Just add the quotes around the merge field)

All Answers

Avidev9Avidev9

You just need to tweak your code

 

if( "{!Quote.With_Concesssion__c}" == "Yes" ) 

 (Just add the quotes around the merge field)

This was selected as the best answer
AshlekhAshlekh

 

Hi ,

 

You can use this also for security resons.

 

if( {"!JSENCODE(Quote.With_Concesssion__c)}" == "Yes" ) 

  

If this is your solution Than mark as a soluiton Please dont foget to give me kudo's by click on star icon.

 

Thanks

Ashlekh Gera

Del_SantosDel_Santos
Thanks!!!