All Projects → chaturvedijai → SF-Lightning-Lookup

chaturvedijai / SF-Lightning-Lookup

Licence: other
Salesforce lightning dynamic lookup component.

Programming Languages

javascript
184084 projects - #8 most used programming language
Apex
172 projects

Projects that are alternatives of or similar to SF-Lightning-Lookup

lwc-redux
Integrate Redux with Lightning Web Component
Stars: ✭ 35 (+133.33%)
Mutual labels:  lightning, salesforce, salesforce-lightning
Design System React
Salesforce Lightning Design System for React
Stars: ✭ 676 (+4406.67%)
Mutual labels:  lightning, salesforce
Salesforcedx Vscode
Salesforce Extensions for VS Code
Stars: ✭ 653 (+4253.33%)
Mutual labels:  lightning, salesforce
Sfdc Ui Lookup
Salesforce Lookup Component (Aura version, maintenance only, see LWC version for updates)
Stars: ✭ 94 (+526.67%)
Mutual labels:  lightning, salesforce
vuetning
Salesforce Lightning Design System framework for Vue.js 2
Stars: ✭ 21 (+40%)
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 (+40%)
Mutual labels:  lightning, salesforce
Purealoe
Salesforce Sample App part of the sample gallery. Agriculture and retail use case. Get inspired and learn best practices.
Stars: ✭ 65 (+333.33%)
Mutual labels:  lightning, salesforce
Indicators
Indicators Lightning Web Component
Stars: ✭ 30 (+100%)
Mutual labels:  salesforce, salesforce-lightning
Haoide
Stop upgrade, most of features were delivered in https://github.com/xjsender/haoide-vscode
Stars: ✭ 194 (+1193.33%)
Mutual labels:  lightning, salesforce
eslint-plugin-aura
Salesforce Lightning (Aura) specific linting rules for ESLint
Stars: ✭ 24 (+60%)
Mutual labels:  salesforce, salesforce-lightning
Salesforce-Custom-Path-Assistant-LWC
A Salesforce custom path assistant built using only Lightning Web Components
Stars: ✭ 37 (+146.67%)
Mutual labels:  salesforce, salesforce-lightning
spaghetti-cmd-loader
Salesforce Custom Metadata Type Loader, designed for Lightning Experience
Stars: ✭ 13 (-13.33%)
Mutual labels:  salesforce, salesforce-lightning
lwc-modules
Build any LWC you want without ever having to touch Apex
Stars: ✭ 20 (+33.33%)
Mutual labels:  lightning, salesforce
server-action-service
Generic and reusable Lightning service component that calls server-side actions
Stars: ✭ 19 (+26.67%)
Mutual labels:  lightning, salesforce
PaymentForm
A form that takes credit card and address information. Uses a ported version of jessie pollack's card component.
Stars: ✭ 40 (+166.67%)
Mutual labels:  salesforce, salesforce-lightning
Lightning Data Grid
A data grid for Lightning Component Framework
Stars: ✭ 24 (+60%)
Mutual labels:  lightning, salesforce
Lightning-Out-Demo
How to use Lightning component in node.js (External websites) by using Lightning Out. It shows how to enable CORS and SSL in Node.js with Video and complete source code.
Stars: ✭ 17 (+13.33%)
Mutual labels:  salesforce, salesforce-lightning
Salesforce-Short-Hands
The main purpose of this repository is to put all the utilities in one place so that other developers can get help and they can also contribute to this repo.
Stars: ✭ 31 (+106.67%)
Mutual labels:  salesforce, salesforce-lightning
Create Lwc App
Quickstart command line interface for scaffolding your Lightning Web Components projects
Stars: ✭ 144 (+860%)
Mutual labels:  lightning, salesforce
sfdc-error-playground
Lightning & Apex Error Playground
Stars: ✭ 30 (+100%)
Mutual labels:  lightning, salesforce

SF-Lightning-Lookup

👉 Note: This component was built with version 40.0 (Summer 17). Different behaviour noticed with previous releases because of lightning:input use.

This lightning component is created to act like a Lookup field. Because in the Lightning world look-up behaves like auto-complete input field, this component replicates the more or less same behaviour.

This can be configured with other lightning components easily by giving the Lookup field API name to the "chosenRecordId" attribute of Lookup component. Use of Bound expression chosenRecordId="{!v.record.LookUpFieldAPI}" automatically places the selected record with record's Lookup field.

Component Details

Component Bundle: Lookup

Attributes
  • objectAPIName : Object API Name for which query will be made. Required
  • chosenRecordId : Holds the selected record Id for look-up field. Required
  • chosenRecordLabel : Holds the Name field value of selected record
  • subHeadingFieldsAPI : Holds the extra fields which can be used to show below the Name field in record list.
  • matchingRecords : Holds the list of matched records.
  • fieldLabel : Label of input field. Required
  • filter : Filter to be applied while searching records. Consider this as Look-up filter. Values must be given separated by comma(,)

Component Bundle: LookupItem

Component used for creating list elements for records drop-down. Used in Lookup component

Attributes
  • record : Holds the single record instance. Required
  • iconCategoryName : Lightning icon category-icon name to show with each record element.

Event: LookupChooseEvent

Component level event used to store and fill the input field with selected record Id and Name. Fired from LookupItem component, handled at Lookup component.

  • recordId : Used to send selected record Id. Required
  • recordLabel : Used to send selected record Name. Required

📗 Implementation Notes:

  • On focusing the input field it shows the recent items viewed for given Object. This replcates the standard beahviour noticed in standard lightning lookup fields. If filter attribute is given then recent items will respect the filter condition.
  • SOSL and SOQL both are utilizied to search for records. SOQL is used to fetch the recently viewed records because SOSL cannoot accept blank text. SOSL is used if input field has text. Also, because searching can be done on non-index fields SOSL gives better performance in terms of speed and record list. With SOSL text fields are considered as indexed.
  • Input text must be greater than 3 in size. Noticed that SOSL throws an error with less than 3 search string length.
  • To show and hide the record drop-down list SLDS "slds-combobox-lookup", "slds-is-open" classes and "v.aria-expanded" attribute is used.
  • $A.getCallback() is used to hide the record list on "onblur" of input field. Because we have an event firing on click of list item, onblur conflict is noticed and dosen't allows to fire the "LookupChooseEvent" event.
  • Maintains the record sharing security.

📗 Usage:

Note: By default SLDS is not included in these components to avoid extra loading of css files

Standalone in Lightning App
<aura:application description="LookupApp" extends="force:slds">

    <!-- with Filter -->
    <c:Lookup fieldLabel="Contact" objectAPIName="Contact"
              subHeadingFieldsAPI="Email,Phone"
              placeholder="Search Contact"
              filter="AccountId='001200000047KEdAAM'"/>

    <!-- without Filter -->
    <c:Lookup fieldLabel="Contact" objectAPIName="Contact"
              subHeadingFieldsAPI="Email,Phone"
              placeholder="Search Contact"/>

</aura:application>
With other lightning component.
//Notice the unbound expression ({#v.contact.Account.Name}) for chosenRecordLabel. 
//Because we don't want to update Related record Name the unbound expression will avoid the setup of extra standard event handling mechanism.

<aura:attribute name="contact"
                    type="Contact"
                    description="Contact record"/>
                    
<c:Lookup fieldLabel="Account" objectAPIName="Account"
          subHeadingFieldsAPI="AccountNumber,Phone"
          placeholder="Search Account"
          chosenRecordLabel="{#v.contact.Account.Name}"
          chosenRecordId="{!v.contact.AccountId}"
          aura:id="lookupid"/>
          
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].