Nearly one year ago we listed our product “Lightning Universal Lookup Component” on AppExchange. Over time we were trying to improve our product according to users’ propositions and request but this year we released the most powerful updated version of LULC package. Hereby we would like to introduce you the new version 2.10. But first, let us say a few words about the component in general, this would be relevant for those who is not familiar with our product yet.  

At the very beginning our component could be beneficial only for developers because Lightning did not contain any component with a specific customization which could be applied for other users. However, Salesforce release Spring 18 opened new features to us and now we are able to use Lightning in Flow. As soon as this update has been released we received so many requests to enable this feature in our component. We decided not to hesitate and start implementing it.

Our Lightning Universal Lookup Component is destined to make operations of Salesforce developers and Administrators less time consuming. If you are one of those who prefers save time and simplify workflow process, you may easily install our package and start using it straightaway. Boost development of your custom components with our powerful lookup component. This component looks like a standard one, customization is so simple and it works everywhere. Sounds tempting, right?

How about new updates!

Performance improvements

The main and the most important update is performance improvement of lookup search. The new updated version transfers less requests to the serves and as a result it became more powerful. In order to reduce the number of requests to the server we used a “delay query”, therefore, we are going to the server only when you stop typing the text.

Generally, it works this way:

clearTimeout (window.timer);
window.timer =  window.setTimeout(
 $A.getCallback(function() {
    // Do search
 });
}), 400);

We have also added a spinner to make it more user-friendly.

Check the demo below:

User-added image

Method of fireChanging is updated

One of the most important updates in the second version was in the method of fireChanging that allows to update selected value from js controller. With this update you do not have to create extra attributes anymore if you want to use this method, just pass new value as a parameter.

See the example below:

Component:

<aura:attribute name="selectedId"
                                   type="String"/>
<aura:attribute name="newValue"
                                   type="String" />
<l_lookup:Lookup aura:id="lookupId"
                                        objectType="User"
                                        selectedRecordId="{!v.selectedId}" />
<lightning:button label=”Change”
  onclick=”{!c.changeIt}” />

    Action in controller to change record Id:

        changeIt : function(cmp, event, helper) {
                                             var newVal = cmp.get("v.newValue");
                                cmp.find("lookupId").fireChanging(newVal);
                   }


You should not be worried if you used the previous version, since it would also work as it used to before.

Some new useful attributes

dropDownQuery and dropDownLimit

By default the component works as a standard Salesforce lookup field and when lookup is in focus it shows the list of recently viewed records. This feature helps users to search records quicker. However, once in a while this feature may not be useful. This scenario happens when you have some top records that users use more often. With new attribute dropDownQuery you can define criteria by which dropDown will be populated instead of a standard list of recently viewed records. Moreover, with dropDownLimit you can configure number of records in drop-down suggestion list. By default dropDownLimit = 5.

In case the attribute is empty a standard process will work which shows 5 recently viewed records if showFiveRecent is not false.

If you use queryCondition as well it will be added to dropDownQuery criteria.

Example:
<aura:attribute name="selectedRecordId" type="String" default="" />
<c:Lookup aura:id="myLookup"
                        objectType="Contact"
                        selectedRecordId="{!v.selectedRecordId}"
                        dropDownQuery="IsActive__c = true"
                        dropDownLimit=”3”  />
Demo:
User-added image

orderBy
New optional attribute that allows to sort your records. You can define the list of fields in order to sort the records.
Salesforce documentation: ORDER BY in SOQL

E.g.:

<aura:attribute name="selectedId" type="Id" />
// Order by Contact Name A-Z
<c:Lookup aura:id="myLookup"
                        objectType="Contact"
                        selectedRecordId="{!v.selectedId}"
                        orderBy=”Name”  />

User-added image

Also you can define several fields by comma separator:

// Order by Name and Created date

<c:Lookup aura:id="myLookup"
                        objectType="Contact"
                        selectedRecordId="{!v.selectedId}"
                        orderBy=”Name DESC, CreatedDate”  />

Translate if required

Our Lightning Universal Lookup Component has become even more flexible in version 2.10. Now you are able to adjust your lookup according to your language. Translate it if necessary. For more information you may read the documentation.

Hope this article would be very useful. In case you have any questions or propositions, please, do not hesitate to leave your comments below or simply send us an email at contact@synebo.io