I am trying to write the following code in a javascript button of case object
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
var caseObject = new sforce.SObject('Case');
caseObject.id = "{!Case.Id}";
alert(':'+caseObject.id);
alert('After Case------'+caseObject.Do_you_currently_have_access+':'+caseObject.Status+':'+caseObject.id);
if(caseObject.Do_you_currently_have_access == true && caseObject.Status == 'Closed'){
caseObject.Checkbox_send_Email = true;
var result = sforce.connection.update([caseObject]);
}
alert('After If------');
location.reload(true);
What is happening is that in the first alert the id is getting printed. In the second alert the id is getting printed. however the other two values are not being printed(though the record has those values populated). It is showing as undefined. I am fairly new in this. Can anyone tell me where am I going wrong?