createRecord(recordInput)

Creates a record.

createRecord uses this User Interface API resource.

  • recordInput—(Required) A RecordInput object used to create the record.
    • apiName—(Required) The API name of a supported object.
    • fields—Map of field names to field values.

Passing in allowOnSaveDuplicate or recordTypeId isn't currently supported. To prevent the creation of duplicate records, use a duplicate rule with a matching rule.

A Promise object that resolves with the created record. The record contains data for the fields in the record layout.

Before you use this wire adapter, make sure that there isn’t an easier way to create the data. Consider using the lightning-record-*-form components to work with records. To update a record, use updateRecord instead.

Use createRecord by passing in the record input. To create a RecordInput object, use generateRecordInputForCreate(record,objectInfo). Alternatively, pass in a recordInput object with the apiName and fields properties.

See Also