You need to sign in to do that
Don't have an account?

Custom Button JScript to set checkbox true
I have an OnClick JScript as below for a Custom Button, where I need to make the checkbox Escalated_Call__c to true.
What is wrong with the below code- No error, but do not make checkbox true.
{!REQUIRESCRIPT("/soap/ajax/41.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
var objCase = new sforce.SObject('Case');
objCase.Escalation_Reason_Details__c ='{!JSENCODE(Case.Escalation_Reason_Details__c)}';
if(objCase.Escalation_Reason_Details__c == '')
{
alert ('Please fill Escalation_Reason_Details__c');
}
else
{
objCase.Escalated_Call__c=true;
}
var result = sforce.connection.update([objCase]);
location.reload(true);
What is wrong with the below code- No error, but do not make checkbox true.
{!REQUIRESCRIPT("/soap/ajax/41.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
var objCase = new sforce.SObject('Case');
objCase.Escalation_Reason_Details__c ='{!JSENCODE(Case.Escalation_Reason_Details__c)}';
if(objCase.Escalation_Reason_Details__c == '')
{
alert ('Please fill Escalation_Reason_Details__c');
}
else
{
objCase.Escalated_Call__c=true;
}
var result = sforce.connection.update([objCase]);
location.reload(true);
You didn't specify ID in update call.
objCase.Id='{!Case.Id}';
This will solve the issue.
Please mark as best if it works.
Thanks.
All Answers
You didn't specify ID in update call.
objCase.Id='{!Case.Id}';
This will solve the issue.
Please mark as best if it works.
Thanks.
Do you know-how do we check if the Multipicklist value field is blank or not in this?
To replace the below Escalation_Reason_Details__c with a multi picklist value?
objCase.Escalation_Reason_Details__c ='{!JSENCODE(Case.Escalation_Reason_Details__c)}';
if(objCase.Escalation_Reason_Details__c == '')
{
alert ('Please fill Escalation_Reason_Details__c');
}
Thanks in Advance.