0

I have a wrapper class which can hold a custom object record and some variables. However I want to leverage this out of the box lightning:recordEditForm for displaying the wrapper class records (custom object record and the variables) as a table. Is this really possible?

I gave it a test with the below code. However all the fields are displaying as read only fields though I used lightning:inputField.

<aura:attribute access="public" name="dataRows" type="test.wrapper[]" default="{sobjectType: 'test.wrapper[]' }"/>
                    <aura:iteration items="{!v.dataRows}" var="recData">
                    <lightning:recordEditForm aura:id="recordEditForm" 
                                              objectApiName="test.wrapper">
1

Does lightning:recordEditForm works for wrapper classes with an sObject?

The short answer is NO.


Because you are trying to use it in an unsupported way, that's why you are not getting the desired results. Below is an explanation of few things which you have wrong here.

  1. You are using lightning:recordEditForm with an Object, whereas this component supports ONLY SObject (and that too not all SObjects).

    A lightning:recordEditForm component is a wrapper component that accepts a record ID and is used to display one or more fields and labels associated with that record

    This component doesn't support all Salesforce standard objects

  2. Unrelated, but still see that in your code. You are trying to declare an inner class as an aura attribute, that's not supported either. Excerpt from documentation.

    Custom classes used for component attributes shouldn’t be inner classes or use inheritance. While these Apex language features might work in some situations, there are known issues, and their use is unsupported in all cases.

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.