Menu

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.

Parent commands

  • batch
    Optional. Groups up multiple Salesforce API requests into one and is highly recommended if creating multiple records in a row.

Child commands

  • field
    Optional. Each field child defines one field value for the created record. With certain object types certain fields are required to have values, therefore making field child commands required in these cases.

Attributes

type

Required
Value type
EL-evaluated
Yes
String Yes
Defines the object type of the created record. The resolved String should be the API name of an object type.

Examples

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, eg. 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}"> 

Comments

0 comments