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
impalacrazy69impalacrazy69 

Custom button to update field value for multiple cases

Below is the code i have found and trying to use to update the products field on my case object. Id like to be able to change multiple cases while viewing a list to a certain product selection but im getting the error: ID not specified in an update call when i click the button. Can someone see what im missing for this simple update

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.Product__c = '{Product__c}';
var result = sforce.connection.update([caseObj]);

if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
location.reload(true);
}
Phillip SouthernPhillip Southern
Hi, is this button on the case page layout and you are looking at that specific case?  If so that should work.

If you are trying to use from a list view or over multiple cases...it won't work, because for your merge field {!Case.Id} is going to work only if you are looking at a particular record.