6

I have a component that contains lightning:recordForm like so:

<lightning:recordForm  
        recordId="001f200001Zg2uYAAR"                  
        objectApiName="Account"
        layoutType="Compact"
        columns="3"
        mode="edit" />

If the layout that is rendered contains "Account Record Type" the following error is displayed at the top of the form:

Field: RecordTypeId is not a valid lookup field.

Is this a known issue? I have not seen other reports of this.

4
  • I observed this too. You may need to reach out to the Salesforce support.
    – Jayant Das
    Commented Sep 25, 2018 at 12:48
  • Yes, had the same issue. Best to raise a case with Salesforce.
    – Ranga
    Commented Sep 25, 2018 at 13:51
  • Does this org have Account Record Types defined? Commented Sep 25, 2018 at 14:06
  • Yes @JeremyNottingham, there are Account Record Types defined.
    – Homerlex
    Commented Sep 25, 2018 at 14:55

2 Answers 2

2

I had a conversation with Salesforce support about this. Its a known issue but there is no timeline on fixing it

Edit @Homerlex I found a workaround if you find the proper record type Id in the init method of your component and save it to an attribute variable called recordTypeId and then update your lighting record form to this, it should remove the error

Component

<lightning:recordForm 
        aura:Id="createAcct" 
        recordId="001f200001Zg2uYAAR"                  
        objectApiName="Account"
        layoutType="Compact"
        columns="3"
        mode="edit"
        onSubmit="{!c.handleSave}" />

Controller

handleSave : function(cmp, event, helper){
        event.preventDefault(); // stop form submission
        var eventFields = event.getParam("fields");
        eventFields['RecordTypeId'] = cmp.get('v.recordTypeId');
        cmp.find('createAcct').submit(eventFields);
    }
2
  • Thanks @CalvinOKeefe. I opened a case with support and they haven't given me an answer yet.
    – Homerlex
    Commented Sep 26, 2018 at 15:56
  • let me know if they tell you something different if you ever hear back from them! Commented Sep 26, 2018 at 19:31
-1

You just need to take the record type off of the page layout that you are using. You will spot getting the error.

1
  • Thats not always possible from a requirements standpoint Commented Oct 25, 2018 at 19:07

You must log in to answer this question.

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