create
Creates a new record of the specified type with field values as defined by child commands. This creation needs to follow all requirements and restrictions of records of that object type, or otherwise the operation fails.
Child Commands
Optional. Each
field
child defines one field value for the created record. With certain object types certain fields are required to have values, therefore makingfield
child commands required in these cases.
Attributes
type |
|
|
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
Defines the object type of the created record. The resolved String should be the API name of an object type. |
The create
command needs to be used with field
commands as its children to define field values for the new record. Be sure to define all required fields and 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.
<create type="Custom_Object__c">
<field name="Name" value="A custom record">
<field name="Opportunity__c" value="${mainOpportunity.Id}">
If creating 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="${newRecordsData}" var="newRecordData">
<create type="Secret_Item__c">
<field name="Name" value="${newRecordData.name}">
<field name="Code__c" value="${newRecordData.secretCode}">