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
SimbaSimba 

Custom Button

I am not able to access any of the SF standard objects attributes(fields). I get an error Object not defined                  not exist.

For now I am trying very simple one line code in a custom object on the Opportunity Detail Page.

Following is the code that I was trying. Ideally I would like to make a call to the Apex Code from the buttons

Problem with the OnClick Javascript - Opportunity is not defined
alert(Opportunity.Name);

Problem with the OnClick Javascript - missing ) after argument list...
alert({!Opportunity.Name} );

Please let me know what could be wrong. I am using Developer Edition for the above example

Thanks


dallas_sfdallas_sf
Have you tried putting the merge fields within quotes like this -  alert('{!Opportunity.Name}' )

??
SimbaSimba
Hello dallas_sf ,

Thanks, that's correct I was missing the quotes around it. It works now.

I really appreciate your reply back.

Regards