0

I have a lightning component in a visualforce page with a look up field but whenever the user clicks on search icon or search it throws and error :

This page has an error. You might just need to refresh it. [PromiseRejection: [Cannot read property 'la' of undefined]]

I referred this documentation, and it says in lightning out it won't show the search dialog or look up box.

This is my component code for the field :

<aura:iteration items="{!v.docList}" var="acc" indexVar="index">
<lightning:recordEditForm aura:id="docmancommunicationform" objectApiName="Docman_Communication__c" >  
<lightning:messages />
<div class="slds-grid slds-gutters">
    <div class="slds-p-right_small"></div>
    <div class="slds_col slds-size_1-of-6" aura:id="dependentnamediv" ><!--class="{!(acc.Select__c == 'Dependent') ?'slds_col slds-size_1-of-7' : 'slds_col slds-size_1-of-7 slds-hide'}"-->
    <span><lightning:inputfield  aura:id="dependentname" fieldName="Dependent__c" value="{!acc.Dependent__c}"/></span></div>

Screenshot of the Error :

enter image description here

Is there any alternate to implement the look up search dialog in lightning out?

Note : I have a dynamic row implementation where users can add/remove rows.

UPDATED CODE to Replace lightning:intputfield with Force:Inputfield :

Component :

  <aura:attribute name="docList" type="Docman_Communication__c[]" />
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
<tbody>     
   <aura:iteration items="{!v.docList}" var="acc" indexVar="index">
          <lightning:recordEditForm aura:id="docmancommunicationform" objectApiName="Docman_Communication__c" >  
           <lightning:messages />
           <div class="slds-grid slds-gutters">
                <div class="slds_col slds-size_1-of-6" aura:id="indexvalue" style="text-align: center;">
                     <div class="slds-p-top_large"></div>
                           <span>{!index + 1}</span></div>
                     <div class="slds_col slds-size_1-of-6" aura:id="dependentnamediv" ><!--class="{!(acc.Select__c == 'Dependent') ?'slds_col slds-size_1-of-7' : 'slds_col slds-size_1-of-7 slds-hide'}"-->
                     <span><force:inputField  aura:id="dependentname" value="{!acc.Dependent__c}"/></span></div>
                     <div class="slds-p-right_small"></div>
                     <div class="slds_col slds-size_1-of-6">
                                                    <span><lightning:inputField fieldName="Rejected_Type__c" value="{!acc.Rejected_Type__c}"/></span>
                                                </div>
                                                <div class="slds-p-right_small"></div>
                                                <div class="slds_col slds-size_1-of-6">
                                                    <span><lightning:inputField aura:id='reason' fieldName="Rejected_Reason__c" value="{!acc.Rejected_Reason__c}"/></span>
                                                </div>

HELPER to Add Row and instance of Docman Communicaiton :

 addrow: function(component) {
 var docobj = component.get("v.docList");
   console.log('docobj'+JSON.stringify(docobj));
    var contactid = component.get("v.contactid");
    var rowItemList = component.get("v.docList");
    rowItemList.push({ 'sobjectType': 'Docman_Communication__c','Select__c':'','PrimaryInformation__c': contactid,'Email_Merge_Field__c':'','SMS_Merge_Field__c':'','DocMan__c':'','Dependent__c':'','Rejected_Type__c': '','Rejected_Reason__c': '',
                       'Deadline__c':''});
    component.set("v.docList", rowItemList);

},

After updating it to force:inputField it does not show the field any more,

updated screenshot

2
  • only lookup field type from lightning:recordEditform is not working in lightning:out? rest of other types is working fine? but document developer.salesforce.com/docs/component-library/bundle/… doesn't mention 'lightning:recordEditform' supports for lightning:out
    – sdandamud1
    Jun 27, 2019 at 14:40
  • @sdandamud1 Yes, rest all fields shows just fine. Only the lookup field does not offer the search dialog option if I clock on search icon or in search results. Jun 27, 2019 at 14:45

1 Answer 1

2

enter image description here

i used force:inputField for look up inside lightning:recordEditForm but i just tested in standaloneapp only, please try below code and let me know

cmp

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes">

    <aura:attribute name="newContact" type="Contact" default="{ 'sobjectType': 'Contact'}"/>

    <!-- Display the new contact form -->
    <div class="Create Contact">
        <lightning:card iconName="action:new_contact" title="Create Contact">
            <lightning:recordEditForm
                                      onsubmit="{!c.handleSubmit}"
                                      onerror ="{!c.handlerror}"
                                      objectApiName="Contact">
                <lightning:messages />
                <lightning:inputField class="slds-col slds-size_1-of-3 slds-p-horizontal_x-small" fieldName="AssistantName" value="{!v.newContact.AssistantName}"></lightning:inputField>
                <lightning:inputField class="slds-col slds-size_1-of-3 slds-p-horizontal_x-small" fieldName="Age__c" value="{!v.newContact.Age__c}"></lightning:inputField>
                <div class="slds-col slds-size_1-of-3 slds-p-horizontal_x-small">
                    <force:inputField  aura:id="lookup" value="{!v.newContact.AccountId}"/>
                </div>

                <lightning:button class="slds-m-top_small" variant="brand" name="update" type="submit" label="Save"  />
            </lightning:recordEditForm>
        </lightning:card>
    </div>

</aura:component>
9
  • I updated it like the one you suggested but now I am not getting the field it self. rowItemList.push({ 'sobjectType': 'Docman_Communication__c','Select__c':'','PrimaryInformation__c': contactid,'Email_Merge_Field__c':'','SMS_Merge_Field__c':'','DocMan__c':'','Dependent__c':'','Rejected_Type__c': '','Rejected_Reason__c': '', 'Deadline__c':''}); component.set("v.docList", rowItemList); This is from the helper where I am adding a new row... and setting the values to DocList Jun 27, 2019 at 14:42
  • r u getting other fields?
    – sdandamud1
    Jun 27, 2019 at 14:47
  • Yes, let me add update to the question with updated code for comp, controller and helper. Jun 27, 2019 at 14:48
  • I added the updated code, all other fields are showing just fine, I will also add a screenshot. Jun 27, 2019 at 14:52
  • the standalone code you added, was that in lightning out? Because that is where the problem is. Jun 27, 2019 at 14:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .