function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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!!!