How to delete child record in Lookup by

How to return data from multiple objects using wrapper class in lightning component

Hey guys, In this post we are going to learn about how to write inner query in Salesforce. And how to fetch data from multiple custom sObject using wrapper apex class in lightning component.

Also in this example we will achieving that how to delete child record if child record has a lookup relationship to the parent sObject.

Files we used in this post example:-

wrapperCustomObjCmp.cmp Lightning Component It is used for display the Input filed of name, address, email, and button Icon of delete on the table.
wrapperCustomObjCmpConroller.js JavaScript Controller File It is used for communicate to server side apex method and fetch the record using init fuction.
wrapperCustomObjCmpHelper.js JavaScript Helper File It is used for refresh the page after delete the record.
wrapperCustomObjCmp.CSS Component Style CSS It is used for creat a custom delete icon from resource.
wrapperCustomObjCtrCmp.apxc Apex Class Controller It is used for delete and fetching the records from multiple sObject from database server

Custom Parent Object:- NewStudent__c

Custom Parent Object Fields:-




Custom Child Lookup Object:- Registration__c

Custom Child Object Fields:-





Custom Object and their fields In this post we used two type of custom sObject. first is Parent object (NewStudent__c) and another is child sObject (Registration__c). We are achieving that how to fetch records from two custom objects and how to delete child record in Lookup relationship..

Other related post that would you like to learn…

Step 1:- Create Lightning Component : wrapperCustomObjCmp.cmp

From Developer Console >> File >> New >> Lightning Component >> wrapperCustomObjCmp.cmp

wrapperCustomObjCmp.cmp [Lightning Component File]

Step 2:- Create Lightning Component : wrapperCustomObjCmpConroller.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

wrapperCustomObjCmpConroller.js [JavaScript Controller]

Step 3:- Create Lightning Component : wrapperCustomObjCmpHelper.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Helper

wrapperCustomObjCmpHelper.js [JavaScript Helper File]

Fetch record from multiple object by

Step 4:- Create Lightning Component Style CSS: wrapperCustomObjCmp.CSS

From Developer Console >> File >> New >> Lightning Component >> Style CSS

wrapperCustomObjCmp.CSS [JavaScript Helper File]

Note:-Static resource custom delete icon

You need to upload a custom delete icon on resource file.

Step 5:- Create Apex Class : wrapperCustomObjCtrCmp.apxc

From Developer Console >> File >> New >> Apex Class

wrapperCustomObjCtrCmp.apxc [Apex Class Controller]

Related further post that you want to learn……

Step 6:- Final Output

fetch data from multiple object in lightning component --

Leave a Comment