function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Racheal Dales 25Racheal Dales 25 

Error with Testapp.app - Source?

I am trying to select multiple users from the User object in Salesforce. i could reproduce all the steps in the link except Testapp.app and got an below error.

http://sfdcmonkey.com/2018/02/20/multi-select-lookup-salesforce-lightning/

Failed to save TestApp.app: The attribute "label" was not found on the COMPONENT markup://c:reUsableMultiSelectLookup: Source

Any help would be greatly appreciated!  My code - 

<aura:application extends="force:slds">
  <!-- Create attribute to store lookup value as a sObject--> 
  <aura:attribute name="selectedLookUpRecords" type="sObject[]" default="[]"/>
 
  <c:reUsableMultiSelectLookup objectAPIName="user"
                               IconName="standard:user"
                               lstSelectedRecords="{!v.selectedLookUpRecords}"
                               label="User Name"/>
   <!-- here c: is org. namespace prefix-->
</aura:application>
 
vijay kumar kvijay kumar k
Hi Racheal

Have declared attribute with name = 'Label' at reUsableMultiSelectLookup component If not please declare attribute, this is the error your getting.
Like : <aura:attribute name="label" type="String" default="None"/>

Regards 
Vijay
Racheal Dales 25Racheal Dales 25
Hi Vijay,

This is the code I already had written within the reUsableMultiSelectLookup which includes this line - 

<aura:attribute name="label" type="string" default="User"/>

I'm guessing that is incorrect since I'm still receiving the error.  Do you know how to change this line to represent the User within Salesforce?
 
<aura:component controller="reUsableMultiSelectLookupCtrl">
    
    <!--declare attributes--> 
    <aura:attribute name="lstSelectedRecords" type="sObject[]" default="[]" description="Use,for store SELECTED sObject Records"/>
    <aura:attribute name="listOfSearchRecords" type="List" description="Use,for store the list of search records which returns from apex class"/>
    <aura:attribute name="SearchKeyWord" type="string"/>
    <aura:attribute name="objectAPIName" type="string" default="user"/>
    <aura:attribute name="IconName" type="string" default="standard:user"/>
    <aura:attribute name="label" type="string" default="User"/>
    
    <!--declare events hendlers-->  
    <aura:handler name="oSelectedRecordEvent" event="c:selectedsObjectRecordsEvent" action="{!c.handleComponentEvent}"/>
    <aura:attribute name="Message" type="String" default=""/>
    
    <!-- https://www.lightningdesignsystem.com/components/lookups/ --> 
    
    <div onmouseleave="{!c.onblur}" aura:id="searchRes" class="slds-form-element slds-lookup slds-is-close">
        <label class="slds-form-element__label">{!v.label}</label>
        <!--This part is for display search bar for lookup-->  
        <div class="slds-form-element__control">
            <div class="slds-input-has-icon slds-input-has-icon--right">
                <!-- This markup is for when an record is selected -->
                <div aura:id="lookup-pill" class="slds-pill-container">
                    <div aura:id="lookupField" class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right"  style="width: 100%;">
                        
                        <ui:inputText click="{!c.onfocus}"
                                      updateOn="keyup"
                                      keyup="{!c.keyPressController}"
                                      class="slds-lookup__search-input slds-input inputSize"
                                      value="{!v.SearchKeyWord}"
                                      placeholder="search.."/>
                        
                        <span class="slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right">
                            <lightning:icon iconName="utility:search" size="x-small" alternativeText="icon"/>
                        </span>
                    </div> 
                <!--Selected Records Pills Section-->
                    <aura:iteration items="{!v.lstSelectedRecords}" var="sr">
                        <lightning:pill class="slds-m-around_xx-small" label="{!sr.Name}" name="{!sr.Id}" onremove="{! c.clear }">
                            <aura:set attribute="media">
                                <lightning:icon iconName="{!v.IconName}" size="x-small" alternativeText="icon"/>
                            </aura:set>
                        </lightning:pill>
                    </aura:iteration>
                </div>
            </div>
        </div>
 
        <!--This part is for Display typehead lookup result List-->  
        <ul style="min-height:40px;margin-top:0px !important" class="slds-listbox slds-listbox_vertical slds-dropdown slds-dropdown_fluid slds-lookup__menu slds" role="listbox">
            <lightning:spinner class="slds-hide" variant="brand" size="small" aura:id="mySpinner"/>
            <center> {!v.Message}</center>
            <aura:iteration items="{!v.listOfSearchRecords}" var="singleRec">
                <!--Child Component--> 
                <c:reUsableMultiSelectLookupResult oRecord="{!singleRec}" IconName="{!v.IconName}"/>
            </aura:iteration>
        </ul>
    </div>
</aura:component>

 
vijay kumar kvijay kumar k
Hi Rachel

I also went through http://sfdcmonkey.com/2018/02/20/multi-select-lookup-salesforce-lightning/ and I also tested the same in my Org. See result I'm getting in below image.
User-added image

I'm able to get the all users one by one and I also posted debug screenshot also it's querying the user as well.
User-added image

So please check again or else delete all components you created and create again.

This is the application code I used.

<aura:application extends="force:slds">
  <!-- Create attribute to store lookup value as a sObject--> 
  <aura:attribute name="selectedLookUpRecords" type="sObject[]" default="[]"/>
 
  <c:reUsableMultiSelectLookup objectAPIName="user"
                               IconName="standard:user"
                               lstSelectedRecords="{!v.selectedLookUpRecords}"
                               label="User Name"/>
   <!-- here c: is org. namespace prefix-->
</aura:application>

Kindly check once again and let me know.

Regards 
Vijay
Racheal Dales 25Racheal Dales 25
Hi Vijay,

Did you make any other alterations to the other components other than the application example above? Specifically what did you enter reUsableMultiSelectLookup which is where I wrote - 

<aura:attribute name="label" type="string" default="User"/>
vijay kumar kvijay kumar k
Hi Racheal 

I didn't change any small change also for me it's working fine expected way.
Please try 2 create new components and check.
vijay kumar kvijay kumar k
Hi Racheal 

Are you still facing the same error while saving the app. if yes send us all components here.
Racheal Dales 25Racheal Dales 25
Hi Vijay,

I was able to get the app to save once I recreated the components.  Now I'm having an issue with 0% code coverage when trying to bring the components over to production.  Any suggestions?  Coding is not my speciality so I'm sure I missed some step.  Thanks for your help!
 
vijay kumar kvijay kumar k
Hi Rachel 
 
@isTest
public class reUsableMultiSelectLookupCtrl_Test{
    @istest
    public static void fetchLookUpValuestestmethod(){
        Account acc = new Account(Name='Test Account');
        insert acc;
        Account acc1 = new Account(Name='Test Account1');
        insert acc1;
        List<Account>accList = New list<Account>();
        accList.add(acc);
        List < sObject > fetchLookUpValues = reUsableMultiSelectLookupCtrl.fetchLookUpValues('Test Account','Account',accList);
    }
}

I think this is useful to you.
Racheal Dales 25Racheal Dales 25
Hi Vijay,

That worked perfectly! I was able to move the code into production but now I can't figure out how to get this component to show up on a page layout.  Would you have any advice on this part?  Thanks in advance.