+ Start a Discussion
Ravi Sankar 12Ravi Sankar 12 

Lightning QuickAction to update child records

I am trying to mass update child records with a lightning quck action on the parent record detail page. Not sure what is wrong with this code. I appreciate your help.

<aura:component controller="MassUpdateController " implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
	<aura:attribute name="data" type="object__c[]"/>
    <aura:attribute name="columns" type="List"/>
    <aura:attribute name="recordId" type="String"/>
    <!-- handlers-->
    <aura:handler name="init" value="{!this}" action="{!c.init }"/>        
    <div style="height: 300px">
            columns="{! v.columns }"
            data="{! v.data }"


		init: function(cmp,event, helper) {
        cmp.set('v.columns', [
            {label: 'Name', fieldName: 'Name', type: 'text'  }            
          //  {label: 'Provider Email', fieldName: 'ProviderEmail', type: 'email', editable: true },
          //  {label: 'Not Associated to this Location', fieldName: 'NotAssociatedToThisLocation', type: 'checkbox' }
        helper.fetchData(cmp,event, helper);        


    fetchData: function (cmp,event,helper) {
        var RecordId = component.get("v.recordId");
        	"recordId" : RecordId
        var action = cmp.get("c.getRecords");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var data = response.getReturnValue();
            // error handling when state is "INCOMPLETE" or "ERROR"

Apex Controller

public class MassUpdateController {
    public static list<Managed_Care_Provider__c> getRecords(Id recordId){
        system.debug(' record Id ' + recordId);
        list<object__c> lstMC = [SELECT Id,Name from Object__c where Opportunity__c=: recordId];
        system.debug('---- list of MC ' + lstMC);
        return lstMC;
Best Answer chosen by Ravi Sankar 12
Ravi Sankar 12Ravi Sankar 12
Solved, In helper I used component instead of cmp

All Answers

Raj VakatiRaj Vakati
I am not seeting any logic here to update .. can you please give me what is thre requirement 

You can do some think like below ..

Refer this link 

Ravi Sankar 12Ravi Sankar 12
Hello Raj,

Thank you for your reply. I have not written the update method. But, this code should atleast display the records.
Ravi Sankar 12Ravi Sankar 12
Solved, In helper I used component instead of cmp
This was selected as the best answer