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
TimCarlTimCarl 

In lightning component I have a text data type input (custom) field in a 'lightning' namespace, <lightning:input>. The field has a 'lookup" relationship to Contact. How do you code this?

Is there a built-in component attribute in any of the namespaces, (ie., lightning:, ui:, or force:, that has a search or lookup functionality to the Contact object record. The field I am working is in a lightning component, within a "form" component attribute.  

Here is a snapshot of the form component in top-level component. 

User-added image

This is a snapshot the custom field 'data type'

User-added image


The app works except when I enter data into the 'Client' field it will not save and create record.

Snapshot of my design.
User-added image

 
Raj VakatiRaj Vakati
Use 
<force:inputField value="{!v.newexpense.Clinet__c}"/>

 
Alain CabonAlain Cabon
Hi,

For the trailhead module, Client = Client__c = Text(50)  so that can work with a simple input and a simple save but that is not your case here.
https://trailhead.salesforce.com/modules/lex_dev_lc_basics/units/lex_dev_lc_basics_prereqs

Salesforce has hidden for along time the missing lookup field (equivalent of <apex:inputField>) for Lightning components. 
https://success.salesforce.com/ideaView?id=08730000000Dom1AAC

There was <force:inputfield> that has never worked correctly.

Now, you should use: <lightning:inputField> ... but there are strong constrainsts and you will need also <lightning:recordEditForm>
http://biswajeetsamal.com/blog/lookup-field-in-lightning-recordeditform/

http://​https://developer.salesforce.com/docs/component-library/bundle/lightning:inputField/documentation
Lookup: Displays an input field for creating a relationship between two objects, for example, the account associated to a contact record.