custom lookup in salesforce

How to create custom lookup on custom object in lightning component

Hey guys, today in this post we are going to learn about how to create custom lookup on custom object and submit the lookup value into database in lightning component.

What is lookup relationship in Salesforce?

Lookup relationship communicate between two objects. First known as Parent Object and Second Known as Child Object.

It is always created on child object. Some time we are working on child object and need to fetch the value of parent object.

In this case we need to create a lookup relationship. It will help to fetch the value of parent object.

Lookup relationship field does not required. If parent record deleted then it’s associated child record does not deleted.

We used the files in this example:-

File Name File Type Description
myCustomLookupCmp.cmp Lightning Component It is used to user interface display on the client side.
myCustomLookupCmpController.js Component JS It is used for communicate the javascript function to apex class method.
myCustomLookupCmp.css CSS For alignment the lookup popover box.
myLookupController.apxc Apex Class Controller For fetch the record value from database server
SVG Icon Image Search Icon Image Lightning Icon Reference :https://www.lightningdesignsystem.com/icons/
static resource Zip file Use for display the Icon from static resource

Final Output

custom lookup on custom object in lightning component -- w3web.net

Other related post that would you like to learn

Note:- Custom sObject >> NewStudent__c

You need to change my custom sObject name with your custom sObject name.

Step 1:-

Lightning Component [myCustomLookupCmp.cmp]

Step 2:-

JS Controller [myCustomLookupCmpController.js]

Step 3:-

Componrnt CSS [myCustomLookupCmp.css]

Step 4:-

Apex Class [myLookupController.apxc]

Note:-Static resource zip file

You need to change $Resource.SLDS2016 with your SLDS zip file name (static resource zip file Name)

Related further post that you want to learn

Leave a Comment