Newer Version Available

This content describes an older version of this product. View Latest

Update a Record

Update a record's data.

User Interface API enforces Salesforce validation rules. If a validation rule fails, the response is an Error with Output.

When you make a PATCH request to update a record, make sure that the record hasn’t changed since the user started editing it. To find out whether it’s safe to save a record, pass the If-Modified-Since HTTP header in the request.

As of API version 43.0, if you pass read-only fields in a request body, the response is an Error with Output.

1/ui-api/records/{recordId}
Available Version
41.0
HTTP Method
PATCH
Example
This example passes a request body to update the name of an Account.
1PATCH /ui-api/records/001R0000003Gjrt
1{
2    "fields": {
3    "Name": "Universal Containers"
4  }
5}
To provide an address, provide the individual fields as separate inputs. The compound field is only available in the response.
1{
2    "fields" : {
3    "Name": "Local Boxes",
4    "BillingState": "WA",
5    "BillingStreet" : "123 Main Street",
6    "BillingCountry" : "USA"
7  }
8}
Request Body
Name Type Description Required or Optional Available Version
allowSaveOnDuplicate Boolean Specifies whether to save a duplicate record (true), or not (false). The default value is false. Optional 43.0
apiName String To create a record, specify the API name of an Object from which to create the record. To update a record, use null or don’t pass this property. Required 41.0
fields Map<String, Object> Map of field names to field values.

Format data types according to these rules:

  • Address—JSON String. Addresses are compound fields and must be broken up into their constituent fields. See the previous example.
  • Boolean—JSON Boolean, true or false
  • Currency—JSON Number (for example, 67.54)
  • Date—JSON string (for example, 2020-04-20)
  • DateTime—JSON string in ISO 8601 format (for example, 2012-02-18T06:40:41.000Z)
  • Double—JSON Number
  • Email—JSON String (for example, joe@smith.com)
  • EncryptedString—JSON String
  • Int—JSON Number
  • Location—JSON String. Location fields are compound fields and must be broken up into their constituent fields.
  • MultiPicklist—JSON String (for example, Dog;Cat;Fish).
  • Percent—JSON Number
  • Phone—JSON String
  • Picklist—JSON String
  • Reference—JSON String
  • String—JSON String
  • TextArea—JSON String
  • Time—JSON String in format HH:MM:SS
  • Url—JSON String

To specify the master record type, either don’t specify the recordTypeId field, or set it to null.

Required 41.0
Response Body
Record