I'm wondering if I am doing this correctly. I'm trying to use the static schema for referential integrity as recommended here, under Import References to Salesforce Objects and Fields, but it doesn't seem "right" to me:

import ISFLAGGED_FIELD from '@salesforce/schema/AccountHistory__c.IsFlagged__c';


handleReset (event) {
    let resetFields = {         
        [ISFLAGGED_FIELD.fieldApiName]: { value: false }
    let recordToReset = generateRecordInputForUpdate({
        //id: this.recordId,
        id: 'a2I4F000000ai15UAA',
        fields:  resetFields           


I've seen it done this way as well, but it seems to defeat the purpose of importing the schema

let resetFields = { IsFlagged__c: { value: false} }

Any help and tips are appreciated!

  • It would help if you showed where generateRecordInputForUpdate and updateRecord come from. Also, Please explain the motivation for your question in more detail. Just edit the question to add these details rather than commenting please. – Phil W Dec 28 '19 at 9:53
  • @PhilW These functions are included in the LWC UI Record API: generateRecordInputForUpdate and updateRecord – Mike G. Dec 28 '19 at 17:55
  • thanks for the clarification. You might have had your own same-named functions... – Phil W Dec 28 '19 at 19:20

Check out the example here: https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.reference_update_record

The argument that is passed into the record parameter when calling updateRecord(record) is in this structure:

    fields: {
        Id: 'a2I4F000000ai15UAA',
        [ISFLAGGED_FIELD.fieldApiName]: false

Try it without generateRecordInputForUpdate() and the "value" property like in the documentation.

|improve this answer|||||
  • Thank you, let me give that object a try. I appreciate the tip. – Mike G. Dec 28 '19 at 18:04
  • For me, this worked without the [ and ] – Sander de Jong Mar 24 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.