Why am I getting a syntax error: Field object. id does not exist. Check spelling while trying to create a button for an apex class with Javascript attached.

106    Asked by DanPeters in Salesforce , Asked on Aug 28, 2023

I was trying to create a button with force apex execute. However, an error popped up: syntax error: Field object.id does not exist. Check spelling. What is missing here? Also, what is [removed]?href= looking for?

Answered by Darsh K

 I think there is a problem in your code. Take an example for force apex execute, where the first parameter is the class name, but for you, it should be InvoiceAccounts_Button. Then, the second value is the method name, which for you should be createInvoiceAccounts. The third value is the arguments map; it should be empty for you.

There is another problem with your merge field, which is {!Object.Id} where instead you should have the API Name of your specific object.

Your Answer


Parent Categories