generateRecordInputForUpdate(record, objectInfo)

Generates a representation of a record (Record Input) that can be used to update a record using updateRecord(recordInput). Passing in ObjectInfo filters the Record Input to only fields that are updateable.

  • record—(Required) A Record object that contains source data. To get data to build the Record object, use the getRecord wire adapters.
  • objectInfo—(Optional) The ObjectInfo corresponding to the apiName on the record. To get the object info, use the getObjectInfo wire adapter. If provided, only fields that are updateable=true (excluding Id) are included in the response.

A Record Input object with its data populated from the given record. Returns all fields whose values are not nested records.

Return the Record Input object on a record.

The object returned by generateRecordInputForUpdate for a contact record looks like this. The fields returned depend on what your admin has included in the object's layout.

We recommend using getRecord with layoutTypes (instead of fields) only if the resulting data will be used with the actual layout.

If you need specific fields, use fields or optionalFields rather than assume that those fields are present in the layout.

See the ldsGenerateRecordInputForCreate example in the lwc-recipes repository.