I have build a process to clone a record x number of times. I have the user enter a number from 1 to 10 on the record and the function copies the record x number of times into an attribute.

I am trying to figure out the best way to display those records on one page so that they user can update each and save the record.

Currently, I am using a lightning:card with lightning:input and lightning:select fields. The problem I am trying to avoid is having to maintain the select values in the code every time they change.

I have tried to use the recordeditform but could not figure out how to iterate the list of records. I don't have an id to populate and I also need to get the default values for the fields populated as a starting point for the user.

Any help would be greatly appreciated! thanks!!


Here is what I ended up doing..... I was able to use the recordEditForm without an ID. I also was able to get the default values from the attribute. This is what I ended up with:

<lightning:card title="Add account">
    <div class="slds-p-around_medium">
        <lightning:recordEditForm objectApiName="Group_Structure__c"  onsubmit="{!c.handleSubmit}">
            <lightning:inputField fieldName="Name" value="{!v.groupstructure.Name}"/>

            <lightning:inputField fieldName="Start_Date__c" value="{!v.groupstructure.Start_Date__c}"/>

            <lightning:button type="submit" name="Submit" label="submit" class="slds-m-top_medium"/>

use lightning:inputField tag inside lightning:recordEditForm. Using inputField will fetch picklist values from database.

  • Thanks Pavanaja. I already have the attribute populated with what I need. I don't copy all of the fields over. But that part is working. My issue is finding a way to create a form that is editible and displays my list from the attribute. I updated my question to show what I am currently using. thanks! – Fred Jan 9 at 14:24
  • is your question is about getting picklist values directly from database instead of hard coding in code? – Pavanaja Y Jan 9 at 14:32
  • I figured it out. I updated my original question with the code that I used. thanks!!! – Fred Jan 9 at 14:53

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.