---
schema_version: "1"
id: e72db5e8b37b898218ace8896f86317f2bc933d41585d156531be7335c131617
title: Update a Record
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/uiapi/ui_api_resources_record_patch.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_patch.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: e2bc87f4f317068007c489155ad2a2f71ac48c6312bc0737239ec2b6e9e5362d
description: Update a record's data.
---
# 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](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_error_with_output.htm#ui_api_responses_error_with_output "Contains extra information about errors. In rare cases, an error message isn't enough to describe the reason for a failure. For example, when a conflicting precondition exists, the error result can include the information about the cause of the conflict.").

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-Unmodified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since "HTML (New Window)") 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](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_error_with_output.htm#ui_api_responses_error_with_output "Contains extra information about errors. In rare cases, an error message isn't enough to describe the reason for a failure. For example, when a conflicting precondition exists, the error result can include the information about the cause of the conflict.").

/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.

PATCH /ui-api/records/001R0000003Gjrt

{
    "fields": {
    "Name": "Universal Containers"
  }
}

To provide an address, provide the individual fields as separate inputs. The compound field is only available in the response.

{
    "fields" : {
    "Name": "Local Boxes",
    "BillingState": "WA",
    "BillingStreet" : "123 Main Street",
    "BillingCountry" : "USA"
  }
}

Request Parameters

<table class="featureTable sort_table" summary="">





              <thead class="thead sorted" align="left">
                <tr>
                  <th class="featureTableHeader vertical-align-top " id="d73538e140">Parameter Name</th>

                  <th class="featureTableHeader vertical-align-top " id="d73538e143">Type</th>

                  <th class="featureTableHeader vertical-align-top " id="d73538e146">Description</th>

                  <th class="featureTableHeader vertical-align-top " id="d73538e149">Required or Optional</th>

                  <th class="featureTableHeader vertical-align-top " id="d73538e152">Available Version</th>

                </tr>

              </thead>

              <tbody class="tbody">
                <tr>
                  <td class="entry" headers="d73538e140" data-title="Parameter Name"><samp class="codeph nolang">allowSaveOnDuplicate</samp></td>

                  <td class="entry" headers="d73538e143" data-title="Type">Boolean</td>

                  <td class="entry" headers="d73538e146" data-title="Description">Specifies whether to save a duplicate record. The default value is
                    <samp class="codeph nolang">false</samp>.
                  </td>

                  <td class="entry" headers="d73538e149" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d73538e152" data-title="Available Version">43.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d73538e140" data-title="Parameter Name"><samp class="codeph nolang">handleOwnerChange</samp></td>

                  <td class="entry" headers="d73538e143" data-title="Type">Boolean</td>

                  <td class="entry" headers="d73538e146" data-title="Description">Specifies whether to return a <samp class="codeph nolang">204 No
                      Content</samp> HTTP status code if the context user loses access to the
                    record during the update. The default value is <samp class="codeph nolang">false</samp>. When <samp class="codeph nolang">false</samp>, if the
                    context user loses access to the record during the update, the update
                    completes successfully, however the resource returns an incorrect <samp class="codeph nolang">404 Not found</samp> HTTP status code.</td>

                  <td class="entry" headers="d73538e149" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d73538e152" data-title="Available Version">60.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d73538e140" data-title="Parameter Name"><samp class="codeph nolang">includeFieldsInBody</samp></td>

                  <td class="entry" headers="d73538e143" data-title="Type">Boolean</td>

                  <td class="entry" headers="d73538e146" data-title="Description">Specifies whether to return a field that’s defined in the request body
                    but not in the layout. The default value is <samp class="codeph nolang">false</samp>. When set to <samp class="codeph nolang">true</samp>,
                    fields that are not in the layout are also included in the response
                    body.</td>

                  <td class="entry" headers="d73538e149" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d73538e152" data-title="Available Version">59.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d73538e140" data-title="Parameter Name">
                    <samp class="codeph nolang">triggerOtherEmail</samp>
                  </td>

                  <td class="entry" headers="d73538e143" data-title="Type">Boolean</td>

                  <td class="entry" headers="d73538e146" data-title="Description">For a Case, specifies whether to send email to users outside the
                    organization. In the Salesforce user interface, this email can be triggered by
                    creating, editing, or deleting a contact for a Case.<p class="p">The default value is
                      <samp class="codeph nolang">false</samp>.
                    </p>
                    <p class="p">See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_header_emailheader.htm" target="_blank" title="HTML (New Window)">EmailHeader</a>
                      in <em class="ph i">SOAP API Developer Guide</em>.</p>
                  </td>

                  <td class="entry" headers="d73538e149" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d73538e152" data-title="Available Version">51.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d73538e140" data-title="Parameter Name"><samp class="codeph nolang">triggerUserEmail</samp></td>

                  <td class="entry" headers="d73538e143" data-title="Type">Boolean</td>

                  <td class="entry" headers="d73538e146" data-title="Description">For a Case or a Lead, specifies whether to send email to users in the
                    organization. In the Salesforce user interface, this email can be triggered by
                    various events: resetting a password, creating a user, changing the Case
                    owner, or adding comments to a Case.<p class="p">For Case owner changes, also set
                      <samp class="codeph nolang">useDefaultRule=true</samp>, or no email is
                      sent.
                    </p>
                    <p class="p">The default value is <samp class="codeph nolang">false</samp>.</p>
                    <p class="p">See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_header_emailheader.htm" target="_blank" title="HTML (New Window)">EmailHeader</a>
                      in <em class="ph i">SOAP API Developer Guide</em>.</p>
                  </td>

                  <td class="entry" headers="d73538e149" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d73538e152" data-title="Available Version">51.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d73538e140" data-title="Parameter Name"><samp class="codeph nolang">useDefaultRule</samp></td>

                  <td class="entry" headers="d73538e143" data-title="Type">Boolean</td>

                  <td class="entry" headers="d73538e146" data-title="Description">
                    <p class="p">For a Case or Lead, specifies whether to use the default (<samp class="codeph nolang">active</samp>) assignment rule. If you specify
                      <samp class="codeph nolang">useDefaultRule</samp>, don’t specify an
                      <samp class="codeph nolang">assignmentRuleId</samp>.
                    </p>

                    <p class="p">For an Account, specifies whether to apply the default territory assignment
                      rules. </p>

                    <p class="p">The default value is <samp class="codeph nolang">false</samp>.</p>

                    <p class="p">See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_header_assignmentruleheader.htm" target="_blank" title="HTML (New Window)">AssignmentRuleHeader</a> in <em class="ph i">SOAP API Developer Guide</em>.</p>

                  </td>

                  <td class="entry" headers="d73538e149" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d73538e152" data-title="Available Version">51.0</td>

                </tr>

              </tbody>

            </table>

Request Body

<table class="featureTable sort_table" summary="">





              <thead class="thead sorted" align="left">
                <tr>
                  <th class="featureTableHeader vertical-align-top " id="d73538e392">Name</th>

                  <th class="featureTableHeader vertical-align-top " id="d73538e395">Type</th>

                  <th class="featureTableHeader vertical-align-top " id="d73538e398">Description</th>

                  <th class="featureTableHeader vertical-align-top " id="d73538e401">Required or Optional</th>

                  <th class="featureTableHeader vertical-align-top " id="d73538e404">Available Version</th>

                </tr>

              </thead>

              <tbody class="tbody">
                <tr>
                  <td class="entry" headers="d73538e392" data-title="Name"><samp class="codeph nolang">allowSaveOnDuplicate</samp></td>

                  <td class="entry" headers="d73538e395" data-title="Type">Boolean</td>

                  <td class="entry" headers="d73538e398" data-title="Description">Specifies whether to save a duplicate record (<samp class="codeph nolang">true</samp>), or not (<samp class="codeph nolang">false</samp>). The
                    default value is <samp class="codeph nolang">false</samp>.<p class="p">Don’t specify
                      this property when checking for duplicate records.</p>
                  </td>

                  <td class="entry" headers="d73538e401" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d73538e404" data-title="Available Version">43.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d73538e392" data-title="Name"><samp class="codeph nolang">apiName</samp></td>

                  <td class="entry" headers="d73538e395" data-title="Type">String</td>

                  <td class="entry" headers="d73538e398" data-title="Description">To create a record, specify the API name of an Object from which to
                    create the record. To update a record, use <samp class="codeph nolang">null</samp> or don’t pass this property. To check for duplicate records,
                    specify the API name of the object for which you’re performing the duplicate
                    check.</td>

                  <td class="entry" headers="d73538e401" data-title="Required or Optional">Required to create a record.<p class="p">Required to check for duplicate
                      records.</p>
                  </td>

                  <td class="entry" headers="d73538e404" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d73538e392" data-title="Name"><samp class="codeph nolang">fields</samp></td>

                  <td class="entry" headers="d73538e395" data-title="Type">Map&lt;String, Object&gt;</td>

                  <td class="entry" headers="d73538e398" data-title="Description">Map of field names to field values.<p class="p">Format data types according to
                      these rules: </p>
                    <ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">Address</samp>—JSON String.
                        Addresses are compound fields and must be broken up into their constituent
                        fields. See the previous example.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Boolean</samp>—JSON Boolean,
                        <samp class="codeph nolang">true</samp> or <samp class="codeph nolang">false</samp>
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Currency</samp>—JSON Number (for
                        example, <samp class="codeph nolang">67.54</samp>)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Date</samp>—JSON string (for
                        example, <samp class="codeph nolang">2020-04-20</samp>)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">DateTime</samp>—JSON string in ISO
                        8601 format (for example, <samp class="codeph nolang">2012-02-18T06:40:41.000Z</samp>)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Double</samp>—JSON Number
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Email</samp>—JSON String (for
                        example, <samp class="codeph nolang">joe@smith.com</samp>)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">EncryptedString</samp>—JSON
                        String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Int</samp>—JSON Number
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Location</samp>—JSON String.
                        Location fields are compound fields and must be broken up into their
                        constituent fields.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">MultiPicklist</samp>—JSON String
                        (for example, <samp class="codeph nolang">Dog;Cat;Fish)</samp>.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Percent</samp>—JSON Number
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Phone</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Picklist</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Reference</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">String</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">TextArea</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Time</samp>—JSON String in format
                        <samp class="codeph nolang">HH:MM:SS</samp>
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Url</samp>—JSON String
                      </li>

                    </ul>
                    <p class="p">To specify the main record type, either don’t specify the <samp class="codeph nolang">RecordTypeId</samp> field, or set it to <samp class="codeph nolang">null</samp>.</p>
                  </td>

                  <td class="entry" headers="d73538e401" data-title="Required or Optional">Required</td>

                  <td class="entry" headers="d73538e404" data-title="Available Version">41.0</td>

                </tr>

              </tbody>

            </table>

Response Body

[Record](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_record.htm#ui_api_responses_record "The field data, API name, child relationship data, and record type information for a record.")

#### See Also

- [Upload Binary Files](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_features_records_binary_upload.htm "If a record has a Base64 field, you can upload binary data to the field when you create or update a record.")