Newer Version Available
Create or Clone a Record
Usage
To create or clone a record, pass a Record Input request body to the POST /ui-api/records resource. To create the request body, you must know the fields, required fields, and default values for that object.
To find the required fields, fields, and default values, make a request to one of these resources.
- Get Default Values to Create a Record
- Get Default Values to Create a Record—Lightweight
- Get Default Values to Clone a Record
- Get Default Values to Clone a Record—Lightweight
The response from these resources includes Object Info, including all fields and a required property for each field.
To find the values for lookup fields, picklist fields, and multi-select picklist fields, use these resources.
- Get Lookup Field Suggestions for a Specified Object
- Get Lookup Field Suggestions
- Get Values for a Picklist Field
- Get Values for All Picklist Fields of a Record Type
As of API version 43.0, if you pass read-only fields in a request body, the response is an Error with Output.
- Resource
-
1/ui-api/records - Available Version
- 41.0
- HTTP Method
- POST
- Example
-
1POST /ui-api/records -
1{ 2 "apiName": "Account", 3 "fields": { 4 "Name": "Universal Containers" 5 } 6} - To provide an address, provide the individual fields as
separate inputs. The compound field is only available in the
response.
1{ 2 "apiName": "Account", 3 "fields" : { 4 "Name": "Local Boxes", 5 "BillingState": "WA", 6 "BillingStreet" : "123 Main Street", 7 "BillingCountry" : "USA" 8 } 9} - Request Parameters
-
Parameter Name Type Description Required or Optional Available Version allowSaveOnDuplicate Boolean Specifies whether to save a duplicate record. The default value is false. Optional 43.0 handleOwnerChange Boolean Specifies whether to return a 204 No Content HTTP status code if the context user loses access to the record during creation. The default value is false. When false, if the context user loses access to the record during creation, creation completes successfully, however the resource returns an incorrect 404 Not found HTTP status code. Optional 60.0 triggerOtherEmail Boolean For a Case, specifies whether to send email to users outside the organization. In the Salesforce user interface, this email can be automatically triggered by creating, editing, or deleting a contact for a Case. The default value is false.
See EmailHeader in SOAP API Developer Guide.
Optional 51.0 triggerUserEmail Boolean 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 automatically triggered by various events: resetting a password, creating a user, changing the Case owner, or adding comments to a Case. For Case owner changes, also set useDefaultRule=true, or no email is sent.
The default value is false.
See EmailHeader in SOAP API Developer Guide.
Optional 51.0 useDefaultRule Boolean For a Case or Lead, specifies whether to use the default (active) assignment rule. If you specify useDefaultRule, don’t specify an assignmentRuleId.
When you create an Account, as long as the account matches any filter for a territory, the Account is assigned to that territory regardless of how useDefaultRule is set.
The default value is false.
See AssignmentRuleHeader in SOAP API Developer Guide.
Optional 51.0 - 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 to create a record. 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 main record type, either don’t specify the RecordTypeId field, or set it to null.
Required 41.0 - Response Body
- Record