1

I tried to use lightning:recordEditForm to create a new custom setting record but I received an error saying

Error in fetching record or record metadata. [Unexpected Error when retrieving 'Custom_Setting__c' Layout Information ]

enter image description here

I can't find any information in the official documentation that custom settings are not supported for lightning:recordEditForm, is this just not documented or is there a way to get it working?


Update: This is the code I use

Application example code

<aura:application >
    <c:CSREF/>
</aura:application>

Lightning component example code

<aura:component >
    <lightning:recordEditForm objectApiName="Custom_Setting__c">
        <div class="slds-box slds-theme_default">
            <lightning:inputField fieldName="Date_Before__c"/>
            <lightning:inputField fieldName="Date_After__c"/>
            <lightning:inputField fieldName="Site__c"/>
            <lightning:inputField fieldName="Project__c"/>
        </div>
    </lightning:recordEditForm>
</aura:component>

Also, Custom_Setting__c is hierarchy custom setting with at least four fields . Date_Before__c, Date_After__c, Site__c, Project__c enter image description here

  • Can you post how are you trying to use/create the custom setting in your component? – Jayant Das Apr 25 '18 at 13:11
  • yes, sure, I am going to update my question – Patlatus Apr 26 '18 at 11:42
  • @JayantDas Edited my question to include the code I use – Patlatus Apr 26 '18 at 11:47
  • Custom Settings are not supported with the component. I have provided more details as an answer. Hope that helps. – Jayant Das Apr 26 '18 at 12:49
1

Even though not explicitly mentioned on the documentation, Custom Settings do not seem to be supported with lightning:recordEditForm. Going through the documentation, below are some details to support this.

The documentation of lightning:recordEditForm mentions:

lightning:recordEditForm and lightning:inputField support the following features.

  • Display a record edit layout for editing a specified record
  • Display a record create layout for creating a new record

The component depends on the UI-API to fetch any layout details of the object to be able to render as create/edit screen along with combination of input fields. And because Custom Settings do not really have any layout associated with them, that is where you get to see the error when you load the component using custom setting (Unexpected Error when retrieving 'Custom_Setting__c' Layout Information) .

Below is an excerpt from UI-API documentation:

This resource returns all the information necessary to display a record in an app: layout metadata, object metadata, and record data.

For a list of objects supported by UI-API, you can find more details here.

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.