All Projects → pozil → Sfdc Ui Lookup

pozil / Sfdc Ui Lookup

Licence: apache-2.0
Salesforce Lookup Component (Aura version, maintenance only, see LWC version for updates)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sfdc Ui Lookup

sfdc-error-playground
Lightning & Apex Error Playground
Stars: ✭ 30 (-68.09%)
Mutual labels:  lightning, salesforce
lwc-redux
Integrate Redux with Lightning Web Component
Stars: ✭ 35 (-62.77%)
Mutual labels:  lightning, salesforce
one-pub-sub-lwc
One PubSub: A Declarative PubSub Library for Lightning Web Component and Aura Component
Stars: ✭ 19 (-79.79%)
Mutual labels:  salesforce, aura
Haoide
Stop upgrade, most of features were delivered in https://github.com/xjsender/haoide-vscode
Stars: ✭ 194 (+106.38%)
Mutual labels:  salesforce, lightning
server-action-service
Generic and reusable Lightning service component that calls server-side actions
Stars: ✭ 19 (-79.79%)
Mutual labels:  lightning, salesforce
eslint-plugin-aura
Salesforce Lightning (Aura) specific linting rules for ESLint
Stars: ✭ 24 (-74.47%)
Mutual labels:  salesforce, aura
SF-Lightning-Lookup
Salesforce lightning dynamic lookup component.
Stars: ✭ 15 (-84.04%)
Mutual labels:  lightning, salesforce
lwc-modules
Build any LWC you want without ever having to touch Apex
Stars: ✭ 20 (-78.72%)
Mutual labels:  lightning, salesforce
Related-List-LWC
My first real foray into Lightning Web Components - an sobject / list view driven lightning data table
Stars: ✭ 21 (-77.66%)
Mutual labels:  lightning, salesforce
vuetning
Salesforce Lightning Design System framework for Vue.js 2
Stars: ✭ 21 (-77.66%)
Mutual labels:  lightning, salesforce
Create Lwc App
Quickstart command line interface for scaffolding your Lightning Web Components projects
Stars: ✭ 144 (+53.19%)
Mutual labels:  salesforce, lightning
Design System React
Salesforce Lightning Design System for React
Stars: ✭ 676 (+619.15%)
Mutual labels:  salesforce, lightning
Sfdc Lax
The service Lightning Component to write a clear asynchronous JavaScript code
Stars: ✭ 109 (+15.96%)
Mutual labels:  salesforce, aura
Purealoe
Salesforce Sample App part of the sample gallery. Agriculture and retail use case. Get inspired and learn best practices.
Stars: ✭ 65 (-30.85%)
Mutual labels:  salesforce, lightning
sfdx-lightning-api-component
⚡️ Promise-based service component for calling REST API from Lightning Aura Components without Named Credentials.
Stars: ✭ 62 (-34.04%)
Mutual labels:  salesforce, aura
Salesforcedx Vscode
Salesforce Extensions for VS Code
Stars: ✭ 653 (+594.68%)
Mutual labels:  salesforce, lightning
Lightning Data Grid
A data grid for Lightning Component Framework
Stars: ✭ 24 (-74.47%)
Mutual labels:  salesforce, lightning
Aura.http
HTTP Request and Response tools
Stars: ✭ 69 (-26.6%)
Mutual labels:  aura
Aura.view
Provides TemplateView and TwoStepView using PHP as the templating language, with support for partials, sections, and helpers.
Stars: ✭ 81 (-13.83%)
Mutual labels:  aura
Lwc Recipes
A collection of easy-to-digest code examples for Lightning Web Components on Salesforce Platform
Stars: ✭ 1,147 (+1120.21%)
Mutual labels:  salesforce

Salesforce Lookup Component (Aura version, maintenance only)

⚠️This Aura version is only maintained for bugs. New features are added to the Lightning Web Component version.

Lookup animation

Lookup with dropdown open

About

This is a generic & customizable lookup component built using Salesforce Lightning (Aura) and SLDS style.
It does not rely on third party libraries and you have full control over its datasource.

Features

The lookup component provides the following features:

  • customizable data source that can return mixed sObject types
  • single or multiple selection mode
  • client-side caching & request throttling
  • built-in server request rate limit mechanism

Multiple or single entry lookup

Documentation

The lookup component is documented using Aura documentation.
You can access it from this URL (replace the domain):
https://<YOUR_DOMAIN>.lightning.force.com/docs/component-library/bundle/c:Lookup/documentation

Follow these steps in order to use the lookup component:

Basic use

1) Write the search endpoint

Implement an Apex @AuraEnabled method (SampleLookupController.search in our samples) that returns the search results as a List<LookupSearchResult>. The method name can be different but it needs to match this signature:

@AuraEnabled
public static List<LookupSearchResult> search(String searchTerm, List<String> selectedIds) {}

2) Handle the search event and pass the results to the lookup

The lookup component exposes an onSearch component event that is fired when a search needs to be performed on the server-side. The parent component that contains the lookup must handle the onSearch event:

<c:Lookup selection="{!v.selection}" onSearch="{!c.lookupSearch}" label="Search"/>

The event handler should do the following:

lookupSearch : function(component, event, helper) {
    // Get the lookup component that fired the search event
    const lookupComponent = event.getSource();
    // Get the Apex server-side action associated with this search (`search` in our samples)
    const serverSearchAction = component.get('c.search');
    // Passes the action to the lookup component by calling the `search` aura method
    lookupComponent.search(serverSearchAction);
}

Advanced use case: custom search parameters

If you need to pass custom parameters like a record id to the Apex search method, you can write the following search event handler:

lookupSearch : function(component, event, helper) {
    // Get the lookup component that fired the search event
    const lookupComponent = event.getSource();
    // Get the SampleLookupController.search server side action
    const serverSearchAction = component.get('c.search');
    // You can pass optional parameters to the search action
    // but you can only use setParam and not setParams to do so
    serverSearchAction.setParam('recordId', component.get('v.recordId'));
    // Passes the action to the Lookup component by calling the search method
    lookupComponent.search(serverSearchAction);
},

And use a custom Apex search method with your extra parameters:

@AuraEnabled(cacheable=true)
public static List<LookupSearchResult> search(String searchTerm, List<String> selectedIds, String recordId) {

}

Advanced use case: lookups in an iteration

If you use lookups in an iteration and need to adjust the search logic based on some iteration parameter, follow these steps.

Wrap the Lookup in a div with a dynamic dataset attribute like so:

<aura:iteration items="{!v.rows}" var="row" indexVar="index">
  <div data-row-index="{!index}">
    <c:Lookup .../>
  </div>
<aura:iteration>

Then, in your search function, do that:

lookupSearch : function(component, event, helper) {
  // Get the lookup component that fired the search event
  const lookupComponent = event.getSource();
  // Get the row index from the parent div
  const rowIndex = lookupComponent.getElement().parentNode.dataset.rowIndex;

  // Handle the rest of the search logic
  // You can use different search endpoints depending on the row index for example
}

Salesforce DX setup instructions

Deploy the sample application with Salesforce DX by clicking on this button:

Deploy

Sample application

The default installation installs the lookup component and a sample application available under this URL (replace the domain):
https://<YOUR_DOMAIN>.lightning.force.com/c/SampleLookupApp.app

If you wish to install the project without the sample application, edit sfdx-project.json and remove the src-sample path.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].