+ Start a Discussion
Anna Rudenko 9Anna Rudenko 9 

Javascript button Object is not defined

We have Account & its child object CSP Passport (master - detail relationship). 
If child passport already exists (one or many), show the user the message to go and clone existing record. 
If there is no child object - the button on Account shall go to standard creation of this child record. The only field I would like to get prepopulated is Account ID (being master-detail relat.).
Now I am getting error "Account is not defined".
Button is created on Account.
if(Account.CSP_Passport_Count__c>= 1) {
    alert("Please clone the latest created CSP Passport form");} 
else {
      window.open('a4e/e?CSP_Passport_Count__c.AccountId ={!Account.Id}');

Thanks in advance for all the suggestions
Hi Anna,

Please replace 3rd line like below.
if( "{!Account.CSP_Passport_Count__c}" >= 1)
it couldn't able to recognize the Account as that should be in formula expression.

Please let us know if that helps.

collection chatcollection chat
Thank You for share great solution about that... (https://chat-roulette.co/)