0

I am currently using c:CustomLookup to search users in the below code but I am looking to use lookup search(<lightning:input type="search"/>) because c:CustomLookup reqires some more efforts like I need to fetch value of the user separately while saving the record.

<aura:component controller="SampleClass">
<aura:attribute name="newJenJob" type="RM_Configuration__c"/>
    <div aura:id="jenUserCrtModal" class="slds-hide">
        <div class="slds-modal slds-fade-in-open">
            <div class="slds-modal__container">
                <div class="slds-modal__header">
                    <div class="align-align--absolute-center">Create Jenkins User</div>
                    <div aura:id="jenUserErrorMsgId" style="color:red;" class="slds-hide slds-align--absolute-center">Please fill all the Mandatory Fields *</div>
                </div>
                <div class="slds-modal__content" style="padding:20px;">
                            <lightning:input name="n1" label="Jenkins User Name" value="{!v.newJenUser.Jenkins_User_Name__c}" required="true"/>
                            <lightning:input name="n2" type="password" value="{!v.newJenUser.Jenkins_Password__c}" label="Jenkins User Password" required="true"/>
                            <!--<force:inputField value="{!v.newJenUser.SFDC_User__c}" required="true"/>-->                             
                            <c:CustomLookup aura:id="jenUsrId" objectAPIName="User" IconName="standard:goals" selectedRecord="{!v.selectedJenUsrLookUpRecord}" label="SFDC User"/>                          
                            <lightning:input name="n5" label="Is Active?" type="checkbox" value="{!v.newJenUser.Jenkins_User_Active__c}" checked="{!v.newJenUser.Jenkins_User_Active__c}"/>
               </div>
               <div class="slds-modal__footer">
                    <div class="align-align--absolute-center">
                        <lightning:button label="Cancel" onclick="{!c.closeModal}" class="cancelBtnStyl"/>
                        <lightning:button label="Save" onclick="{!c.saveJenUser}" class="saveBtnStyl"/>
                    </div>
              </div>
           </div>
       </div>
       <div class="slds-backdrop slds-backdrop--open"></div>           
    </div>
<aura:component>

Can anyone please let me know how to do that?

  • please share what you have tried alongside your specific problem, show a minimum level of effort before posting. additionally, take some time to read How to Ask and take the tour and update your post accordingly. Thanks – Himanshu Nov 16 '17 at 10:17
  • @Himanshu, I have put the things what I am trying, Can you please tell me whether it is possible in this way or not. – Kiruthika Nov 16 '17 at 11:10
7

I think you have mistaken <lightning:input type="search"/> as a standard lookup component.

It is a mere input control, which when defined as type = "search" will just display the Lightning Design System search utility icon.

Refer here for documentation

You will have to build a custom lookup field to achieve this. Hence custom code would be required

Here are a few examples which will help you in creating the lookup component.

  • Great answer! another option is to use Strike Lookup from the strike library - very recommended!!! – Itai Shmida Nov 19 '17 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.