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
Newbie10Newbie10 

Custombutton javascript error.please help

Hi ,

I am trying to do Java script,on click of a custom button.

I am trying to fetch a custom field from another record and check against it

 

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit
var acc_ID = "{!Lead.Account__c}";
var accounts = sforce.connection.query(
"Select Eligible_for_Deal_registration__c From Account WHERE ID = '" + acc_ID + "'");
var records_accounts = accounts.getArray("records");
var account_eligbility = records_accounts[0].Eligible_for_Deal_registration__c;

 

But giving me this error below. 

Cannot read property Eligible_for_Deal_registration__c of undefined

 

 

 

Marko LamotMarko Lamot

put   alert(accounts); immedietaly  after sforce.connection.query statement;

what does it alert?