update
Sets new values for one or more fields of an existing Salesforce record.
Parent commands
batch
Optional. Groups up multiple Salesforce API requests into one and is highly recommended if updating multiple records of the same object type in a row.
Child commands
field
Required. Eachfield
child defines one field to update. At least onefield
withname
of "Id" is required to specify the ID of the record to update.
Attributes
type | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
Defines the object type of the record to update. The resolved String should be the API name of an object type. |
Examples
The update
command needs to be used with field
commands as its children to define which field values receive new values. One field that always has to be defined is "Id", which must be the ID of the record to update. With other fields make sure to use values of kinds matching the field types, e.g. DateTime value for Date/Time field. To set references, use the referenced record's Id as the value. To set a field's value as null, use an expression that resolves into a string of zero characters, such as ${''}.
<update type="Opportunity"><field name="Id" value="${id}"/><field name="Description" value="${newDescription}"/><field name="Custom_reference__c" value="${customRecord.Id}"/><field name="Field_to_null__c" value="${''}"/>
If updating multiple records of the same type, use the batch
command to lessen the amount of API requests and speed up the process.
<batch><forEach value="${recordUpdates}" var="updateData"><update type="Secret_Item__c"><field name="Id" value="${updateData.id}"><field name="Code__c" value="${updateData.secretCode}">