Loading...
New Winner – Cross-Border Excellence | Payoneer India 2026 Check out
Featured Recognized by Salesforce; Proven by impact! Check out

Salesforce provides many standard components that can be used in Lightning Experience to develop an application. But sometimes, we need to create custom components to meet specific requirements.

A lookup field is a reference to another object in Salesforce. It allows you to link one object to another object.

Creating a custom lookup in an Aura component allows users to search for records of a specified object type and select a record from the results.

This can be a useful feature in many applications, as it provides a quick and efficient way for users to find and reference relevant records. By default, Salesforce provides the Lookup component, but it has some limitations, such as it only works with standard objects and only allows you to search by record name.

To overcome these limitations, we can create a custom lookup component that allows us to search and link any object in Salesforce.

In this article, we will discuss how to create a custom lookup in Aura Component. Let’s begin!

Step 1: Create the Apex Class:

The first step in creating a custom lookup is to create an Apex class that will be used to perform the search for records. In this example, we will create an Apex class called ‘customLookup’ that contains a single method called ‘searchRecords’.

This method takes two parameters: the name of the object to search for and the search string entered by the user.

The method returns a list of records that match the search criteria.

Here is an example of what the Apex Class might look like

Step 2: Create the Aura Component:

Now that we have created the Apex class, we can move on to creating the Aura component that will use it. In this example, we will create an Aura component called ‘customLookupComponent’.

The component will contain several attributes, including ‘objectName’, ‘searchString’, ‘records’, and ‘selectedRecord’. It will also include an input field for the user to enter their search criteria, a dropdown menu to select the object to search for, and a list of results returned by the Apex class.

Here is an example of what the Aura Component might look like:

Step 3: Create a JavaScript Controller:

The final step is to create a JavaScript controller to handle the user interactions and make calls to the Apex method we created in Step 1.

In this controller, we will write methods to handle the search, select, clear, and cancel actions. Here is an example of what the JavaScript controller might look like.

js-meta.xml:

Now we have set it’s path to Record Page in aura component file using “implements” attribute.

Next, we will see how to set up this aura component custom lookup in salesforce org.

Setting up the aura component custom lookup in Salesforce org.

Click on the setting icon in vs code there you find the Command Palette option click on it or Use ctrl+shift+p (keyboard shortcut).

Search open default org. It will redirect to your default org in which you have created the project.

Next, open any of the objects where you want to set this custom lookup, and then

  • Click on the setup gear icon
  • Click on the edit page and
  • Select the custom file which you have created
  • Drag and drop where you want to use in that page
  • Now save and activate it.

Now you have just created a custom lookup using Aura Component. You can see the changes in which object record page you have created.

Below is an example of what it looks like. Whatever object you will select from the Dropdown, here I have created 3 objects Account, Contact, and Opportunity, they will show you the records and you can select the record to display it on the search field and click on the cancel icon to remove that record and choose another record.

The Below Image shows how it looks when you click on any record:

Conclusion:

With the knowledge gained from this blog, you can now easily create your own custom lookup components and tailor them to your specific needs. Be sure to try out the solution and stay tuned for our upcoming blogs. Till then, happy coding!

No Data Found.

Related Articles
Salesforce Acquisition of Cresta: Bringing the Future of Voice Agents Closer

Customer service is moving beyond chatbots that simply answer common questions. Businesses are now looking at AI that can understand a customer’s problem, respond naturally and take action without making every interaction feel like a scripted conversation. Voice is an important part of this change. Customers often pick up the phone when an issue is […]

Read More
Salesforce Acquisition of Rune Technologies: Taking Missionforce to the Frontlines

Salesforce has been expanding its business through acquisitions, but its latest move brings a different area of technology into focus. The company has signed an agreement to acquire Rune Technologies, a defense technology company working on military logistics and frontline operations. Announced on October 29, 2026, this Salesforce acquisition is expected to strengthen its government […]

Read More
Salesforce Agent Fabric: From AI Failures to Automatic Intervention

AI agents can be useful until something goes wrong. A model change can affect the answers an agent gives, an API update can interrupt a task, or growing usage can push costs beyond expectations. The bigger concern is that these problems may continue before anyone notices. Salesforce’s latest Agent Fabric update, announced on October 27, […]

Read More
Salesforce Gartner Magic Quadrant 2026: What the Recognition Means for Digital Commerce

Salesforce has secured a Leader position in the 2026 Gartner Magic Quadrant for Digital Commerce for the 11th consecutive year. Its position furthest to the right for Completeness of Vision adds another milestone to the company’s ongoing work in B2B and B2C commerce. The announcement comes at a time when shopping habits are shifting beyond […]

Read More
Slack Frontline: What’s New and Why It Matters for Deskless Teams

Many employees work on store floors, factory lines, healthcare visits, and customer sites rather than sitting at a desk. Yet, they often miss important updates because company tools are designed mainly for office teams. Slack is addressing this gap with a new solution. Announced on October 19, 2026, Slack Frontline brings mobile-first communication, company information, […]

Read More
Salesforce Acquires Braze: What This Means for the Future of Marketing

Salesforce has announced a definitive agreement to acquire Braze for approximately $5.66 billion. Announced on October 20, 2026, the deal aims to strengthen Salesforce’s marketing capabilities and help businesses deliver more personalized customer experiences. Braze is a customer engagement platform that helps businesses connect with customers through channels such as email, SMS, mobile apps, websites, […]

Read More
Our Location worldwide
Indian Flag India
7th Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203669505
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
CA Flag Canada
HIC Global Solutions INC
6D - 7398 Yonge St #1124 Thornhill, ON L4J 8J2 Canada +1(262) 310-7818