1

I have a custom edit form, it has a bunch of lightning-input-fields. One of which is a picklist called Promo__c that has a global value set.

When you hit submit it takes the code here

handleSubmit(event){
    event.preventDefault();
    this.isSubmitting = !this.isSubmitting;
    if(this.checkIfNull()){
    const fields = event.detail.fields;

    fields.Cabinet__c = this.selectCab;
    fields.Brand__c = this.selectBrand;

    this.template.querySelector('lightning-record-edit-form').submit(fields);
    publish(this.messageContext,BLUESUBMI_LMS);
}

This works, saves the file to salesforce, if i wanted to i can go to the record, but after that i have a handleSuccess event

handleSuccess(event){
        this.template.querySelector('c-igt_-quote-line-items-table').refreshChild();

    const evt = new ShowToastEvent({
        title : "Quote Worksheet",
        message : "New Quote Line Item Created  ",
        variant : "Success"
    });
    this.dispatchEvent(evt);
    this.createOppLine(event);

and then it goes to createOppLine(event). I added a console.log here

createOppLine(event){
    let oli = { 'sobjectType' : 'OpportunityLineItem' };
    const fields = event.detail.fields;
    console.log( ' create opp line event data ' + JSON.stringify(fields));
        oli.Product2Id = this.selectedProduct;

        if(this.revenueModel == 'For Sale'){
            oli.UnitPrice = fields.Min_or_Flat_Fee_Amount__c.value;
        } else {
            oli.Customer_RPU_Day__c = fields.Min_or_Flat_Fee_Amount__c.value;
            oli.UnitPrice = 0;
        }

        oli.Revenue_Model__c = this.revenueModel;
        oli.Promo__c = fields.Promo__c.value;
        oli.Quantity = fields.Quantity__c.value;
        oli.OpportunityId = this.parentOpp;
        oli.PricebookEntryId = this.priceBookEntry;

        createOppLineItem({ newOppLine : oli})
        .then(result => {
            this.newQuoteLineItem = null;
        })
        .catch(error => {
            this.newQuoteLineItem = null;
            this.error = error;
        });
}

Now my user account has access to the Promo__c field (perm set). I select a value for promo and it saves....but when we get to

    oli.Promo__c = fields.Promo__c.value;

fields.Promo__c.value is undefined. If i comment out that line everything works. I have no idea why this is happening.

added debug log from the console.log above, as you can see Promo__c is not included in the fields.

create opp line event data {"Auto_TBD__c":{"displayValue":null,"value":false},"BLUE_To_Game_Theme__c":{"displayValue":null,"value":"CRYSTAL_CURVE : test theme"},"Brand__c":{"displayValue":null,"value":"a9W0R0000004SG6UAM"},"Brand__r":{"displayValue":"test Brand","value":{"apiName":"Brand__c","childRelationships":{},"fields":{"Id":{"displayValue":null,"value":"a9W0R0000004SG6UAM"},"Name":{"displayValue":null,"value":"test Brand"}},"id":"a9W0R0000004SG6UAM","lastModifiedById":"0051O00000D0r51QAB","lastModifiedDate":"2022-02-01T00:18:11.000Z","recordTypeId":"012000000000000AAA","recordTypeInfo":null,"systemModstamp":"2022-02-01T00:18:11.000Z"}},"Build_Type__c":{"displayValue":"Replacement","value":"Replacement"},"Business_Segment__c":{"displayValue":null,"value":null},"Cabinet_Style__c":{"displayValue":null,"value":null},"Cabinet_Type__c":{"displayValue":"Excess Inventory","value":"Excess Inventory"},"Cabinet__c":{"displayValue":null,"value":"a9X0R0000004I0vUAE"},"Cabinet__r":{"displayValue":"CRYSTAL_CURVE","value":{"apiName":"Cabinet__c","childRelationships":{},"fields":{"Id":{"displayValue":null,"value":"a9X0R0000004I0vUAE"},"Name":{"displayValue":null,"value":"CRYSTAL_CURVE"}},"id":"a9X0R0000004I0vUAE","lastModifiedById":"0051O00000D0r51QAB","lastModifiedDate":"2022-02-01T00:20:26.000Z","recordTypeId":"012000000000000AAA","recordTypeInfo":null,"systemModstamp":"2022-02-01T00:20:26.000Z"}},"Conv_from_Trade_Show__c":{"displayValue":null,"value":false},"Converted_Opportunity__c":{"displayValue":null,"value":null},"Converted_Opportunity__r":{"displayValue":null,"value":null},"CreatedBy":{"displayValue":"Tony Rissone","value":{"apiName":"User","childRelationships":{},"fields":{"Id":{"displayValue":null,"value":"0051O00000D0r51QAB"},"Name":{"displayValue":null,"value":"Tony Rissone"}},"id":"0051O00000D0r51QAB","lastModifiedById":"0051O00000D0r51QAB","lastModifiedDate":"2022-02-01T00:02:24.000Z","recordTypeId":null,"recordTypeInfo":null,"systemModstamp":"2022-02-04T16:18:48.000Z"}},"CreatedById":{"displayValue":null,"value":"0051O00000D0r51QAB"},"CreatedDate":{"displayValue":"2/4/2022 12:49 PM","value":"2022-02-04T20:49:57.000Z"},"Current_Brain_Box__c":{"displayValue":null,"value":null},"Current_Panel__c":{"displayValue":null,"value":null},"Current_Reels__c":{"displayValue":null,"value":null},"Custom_Laminate__c":{"displayValue":null,"value":null},"Custom_Stand__c":{"displayValue":null,"value":null},"Discount__c":{"displayValue":null,"value":null},"Display__c":{"displayValue":"LCD","value":"LCD"},"File_Number__c":{"displayValue":null,"value":null},"Form_Factor__c":{"displayValue":null,"value":null},"From_Button_Panel__c":{"displayValue":null,"value":null},"From_Product__c":{"displayValue":null,"value":null},"From_Product__r":{"displayValue":null,"value":null},"From_Reel__c":{"displayValue":null,"value":null},"From_Theme_Denom__c":{"displayValue":null,"value":null},"From_Theme_Formula__c":{"displayValue":null,"value":null},"From_Theme_Manual__c":{"displayValue":null,"value":null},"From_Theme__c":{"displayValue":null,"value":null},"From_Theme__r":{"displayValue":null,"value":null},"From_Theme_text__c":{"displayValue":null,"value":null},"GTECH__c":{"displayValue":null,"value":0},"Game_Title__c":{"displayValue":null,"value":null},"Generic_Product__c":{"displayValue":null,"value":null},"INC_REP_CONV__c":{"displayValue":null,"value":"REP"},"Incremental__c":{"displayValue":null,"value":false},"Juris_Type__c":{"displayValue":null,"value":null},"Laminate_Name_and_Manufacturer__c":{"displayValue":null,"value":null},"LastModifiedBy":{"displayValue":"Tony Rissone","value":{"apiName":"User","childRelationships":{},"fields":{"Id":{"displayValue":null,"value":"0051O00000D0r51QAB"},"Name":{"displayValue":null,"value":"Tony Rissone"}},"id":"0051O00000D0r51QAB","lastModifiedById":"0051O00000D0r51QAB","lastModifiedDate":"2022-02-01T00:02:24.000Z","recordTypeId":null,"recordTypeInfo":null,"systemModstamp":"2022-02-04T16:18:48.000Z"}},"LastModifiedById":{"displayValue":null,"value":"0051O00000D0r51QAB"},"LastModifiedDate":{"displayValue":"2/4/2022 12:50 PM","value":"2022-02-04T20:50:00.000Z"},"Machine_Configuration__c":{"displayValue":null,"value":null},"Mapped_Quantity__c":{"displayValue":null,"value":1},"Mapped_Terms__c":{"displayValue":null,"value":null},"Min_or_Flat_Fee_Amount__c":{"displayValue":null,"value":42},"Name":{"displayValue":null,"value":"GT-129181"},"New_Opening_Expansion__c":{"displayValue":null,"value":false},"Notes__c":{"displayValue":null,"value":"test"},"OppProductRef__c":{"displayValue":null,"value":null},"OppProduct_Link__c":{"displayValue":null,"value":"<a href=\"/\" target=\"_blank\">Click Here</a>"},"Opportunity_Product__c":{"displayValue":null,"value":null},"Opportunity_Product__r":{"displayValue":null,"value":null},"Optional_Setup_Software__c":{"displayValue":null,"value":null},"Parent_Opportunity__c":{"displayValue":null,"value":null},"Parent_Opportunity__r":{"displayValue":null,"value":null},"Payment_Terms__c":{"displayValue":null,"value":null},"Paytable_Percent__c":{"displayValue":null,"value":null},"Player_Tracking__c":{"displayValue":null,"value":null},"Plex__c":{"displayValue":null,"value":null},"Poker__c":{"displayValue":null,"value":null},"Printer__c":{"displayValue":null,"value":null},"Quantity__c":{"displayValue":null,"value":1},"RecordType":{"displayValue":"Premium New Build","value":{"apiName":"RecordType","childRelationships":{},"fields":{"Id":{"displayValue":null,"value":"01214000001NcbsAAC"},"Name":{"displayValue":"Premium New Build","value":"Premium New Build"}},"id":"01214000001NcbsAAC","lastModifiedById":"0051O00000D0r51QAB","lastModifiedDate":"2022-02-04T16:50:36.000Z","recordTypeId":null,"recordTypeInfo":null,"systemModstamp":"2022-02-04T16:50:36.000Z"}},"RecordTypeId":{"displayValue":null,"value":"01214000001NcbsAAC"},"Record_Type_Name__c":{"displayValue":null,"value":null},"Replacing__c":{"displayValue":"Yes: with New Build","value":"Yes: with New Build"},"Sales_Price__c":{"displayValue":null,"value":null},"Sales_Toolkit__c":{"displayValue":null,"value":"a4W0R000000NL4cUAG"},"Sales_Toolkit__r":{"displayValue":"ST-066660","value":{"apiName":"Sales_Toolkit__c","childRelationships":{},"fields":{"Id":{"displayValue":null,"value":"a4W0R000000NL4cUAG"},"Name":{"displayValue":null,"value":"ST-066660"},"RecordTypeId":{"displayValue":null,"value":"01214000001NcbrAAC"}},"id":"a4W0R000000NL4cUAG","lastModifiedById":"0051O00000D0r51QAB","lastModifiedDate":"2022-02-04T20:50:01.000Z","recordTypeId":"01214000001NcbrAAC","recordTypeInfo":{"available":true,"defaultRecordTypeMapping":false,"master":false,"name":"EGM Build","recordTypeId":"01214000001NcbrAAC"},"systemModstamp":"2022-02-04T20:50:01.000Z"}},"Screen_Type_From__c":{"displayValue":null,"value":null},"Seats__c":{"displayValue":null,"value":null},"Serial_Number_Manual__c":{"displayValue":null,"value":"0"},"Serial_Number__c":{"displayValue":null,"value":"0"},"Sign__c":{"displayValue":null,"value":null},"Signage__c":{"displayValue":null,"value":null},"Signature_Required__c":{"displayValue":null,"value":null},"Slant_Configuration__c":{"displayValue":null,"value":null},"Spare_Cash_Boxes__c":{"displayValue":null,"value":null},"Standard_Build_or_Laminate__c":{"displayValue":"Standard Build","value":"Standard Build"},"Stands__c":{"displayValue":null,"value":null},"Terms__c":{"displayValue":null,"value":null},"Theme_Code__c":{"displayValue":null,"value":"125"},"To_Actual_Theme__c":{"displayValue":null,"value":"a090R00000EYeOYQA1"},"To_Actual_Theme__r":{"displayValue":"test theme","value":{"apiName":"Theme__c","childRelationships":{},"fields":{"Id":{"displayValue":null,"value":"a090R00000EYeOYQA1"},"Name":{"displayValue":null,"value":"test theme"}},"id":"a090R00000EYeOYQA1","lastModifiedById":"0051O00000D0r51QAB","lastModifiedDate":"2022-02-01T00:18:39.000Z","recordTypeId":"012000000000000AAA","recordTypeInfo":null,"systemModstamp":"2022-02-01T00:18:39.000Z"}},"To_Button_Panel__c":{"displayValue":null,"value":null},"To_Reel__c":{"displayValue":null,"value":null},"To_Theme_Denom__c":{"displayValue":"0.01","value":"0.01"},"To_Theme__c":{"displayValue":null,"value":"01t5Y00000DY3JZQA1"},"To_Theme__r":{"displayValue":"CRYSTAL_CURVE : test theme","value":{"apiName":"Product2","childRelationships":{},"fields":{"Id":{"displayValue":null,"value":"01t5Y00000DY3JZQA1"},"Name":{"displayValue":null,"value":"CRYSTAL_CURVE : test theme"},"RecordTypeId":{"displayValue":null,"value":"0125Y000001PPdPQAW"}},"id":"01t5Y00000DY3JZQA1","lastModifiedById":"0051O00000D0r51QAB","lastModifiedDate":"2022-02-04T17:32:23.000Z","recordTypeId":"0125Y000001PPdPQAW","recordTypeInfo":{"available":true,"defaultRecordTypeMapping":false,"master":false,"name":"Trade Sale","recordTypeId":"0125Y000001PPdPQAW"},"systemModstamp":"2022-02-04T17:32:23.000Z"}},"To_Theme_del__c":{"displayValue":null,"value":null},"Top_Box__c":{"displayValue":null,"value":null},"Topper_Conversion__c":{"displayValue":null,"value":null},"Topper__c":{"displayValue":null,"value":true},"Use_Existing_Customer_Profile__c":{"displayValue":null,"value":true}}

but here's the edit form package prior to submit where the Promo__c is showing.

 fields prior to submit and AFTER to custom additions : {"To_Theme_Denom__c":"0.01","Promo__c":"EM - Content Promotion – LAC","Min_or_Flat_Fee_Amount__c":"54","Quantity__c":1,"Discount__c":null,"Standard_Build_or_Laminate__c":"Standard Build","Incremental__c":false,"Use_Existing_Customer_Profile__c":true,"Topper__c":true,"Notes__c":"test","Cabinet__c":"a9X5Y000000Y1xUUAS","Brand__c":"a9W5Y000000Pwf2UAC","To_Theme__c":"01t5Y00000DY1pRQAT","Sales_Toolkit__c":"a4W5Y000002e5m4UAA","To_Actual_Theme__c":"a095Y00001BqV7cQAF"}

added createOppLineItem() apex class

    @AuraEnabled
    public static void createOppLineItem(OpportunityLineItem newOppLine){
        insert newOppLine;
    }

edit: any admins know how i can give the bounty to glls? He inspired me to give field access to the picklist at the profile level. Which solved the issue

14
  • which is undefined? fields ? fields.Promo__c ? or fields.Promo__c.value ?
    – glls
    Commented Feb 4, 2022 at 20:41
  • fields.Promo__c.value
    – ensir
    Commented Feb 4, 2022 at 20:41
  • can you debug and let us know what fields.Promo__c returns?
    – glls
    Commented Feb 4, 2022 at 20:46
  • 1
    Well i would think if the first record saves then the payload includes the field. I go to the record and the field has a value stored. but i'll put that in and check
    – ensir
    Commented Feb 4, 2022 at 22:08
  • 1
    i'm not familair enough with global picklist value saving, however, if there were a formating error or somehting, usually, the record ui api will throw an error, out of curiosity, if you set the filed visibility at a profile level, instead of the perm set, does it change anything? (should work with perm set though)
    – glls
    Commented Feb 7, 2022 at 21:08

1 Answer 1

1
+50

Not sure if this is considered a Fix, however, sometimes, when experiencing FLS issues even though my permission set should technically grant me access to it I check the following to things:

  • Make sure that the profile has the FLS that my permission set is supposed to grant my user.

  • Ensure that the Layout my profile has access to has the field in it.

2
  • 1
    honestly it's some weird behavior. Only with restricted picklists has been a thing.
    – ensir
    Commented Feb 10, 2022 at 23:06
  • I did some further testing. It being on the layout doesn't matter, what matters is if access to the restricted picklist is granted at the profile level.
    – ensir
    Commented Feb 16, 2022 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .