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
AndBuAndBu 

"Id of current record" is not defined

Hi all!
I create a new custom button with onclick javascript. And when I trying to get Id of current record, I get a message: "a04w000000OXtAN is not defined", where a04w000000OXtAN - Id of current record.
Here my code:
{!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')}
{!REQUIRESCRIPT('/soap/ajax/29.0/apex.js')}


try{
var user = sforce.connection.getUserInfo();
var STE = new sforce.SObject("Object__c");
STE.Id={!package_prefix__Object__c.Id};
}
catch(er)
{
alert(er);
}

 
Best Answer chosen by AndBu
Vikash TiwaryVikash Tiwary
I believe Id(a04w000000OXtAN) is treated as a string. Try enclosing id either in single or double quote.

Please let me know if this helps.

Thanks 

All Answers

Vikash TiwaryVikash Tiwary
I believe Id(a04w000000OXtAN) is treated as a string. Try enclosing id either in single or double quote.

Please let me know if this helps.

Thanks 
This was selected as the best answer
AndBuAndBu
Thanks!