+ Start a Discussion

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
<force:inputField value="{!v.newexpense.Clinet__c}"/>

Alain CabonAlain Cabon

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.

Salesforce has hidden for along time the missing lookup field (equivalent of <apex:inputField>) for Lightning components. 

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>

Lookup: Displays an input field for creating a relationship between two objects, for example, the account associated to a contact record.