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
Radoslav AtanasovRadoslav Atanasov 

What Field Types Does Lightning's force:inputField Support?

The documentation leaves the impression that the force:inputField component is capable of rendering the appropriate UI for any type of field (almost like "magic"), as no restrictions are mentioned and no supported type list exists.

My questions:
  1. Is my expectiotaion that it should be able to handle any type of field on any sObject realistic? If not, can anyone share more information on what is fully supported, what is not, any issues and workarounds you had, and so on?
  2. Are there some other restictions or problematic integrations, like say binding to records loaded with force:recordPreview (Lightning Data Services)?
My experimentation with a very simple stand-alone Lightning app shows that while it works with some simple types of fields, like Account.Name (of type Name), Account.SLAExpirationDate (of type Date), it seems to have issues with more complex types of fields, like Account.ParentId (of type Lookup(User)) and Account.Industry (of type Picklist).

Here's what a force:inputField bound to Account.ParentId looks like in my simple stand-alone Lightning app (and it doesn't seem to work either):
User-added image
Here's the sole app component's source:
<aura:component controller="TestController">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />    
	<aura:attribute name="account" type="Account" default="{ 'sobjectType': 'Account' }"/>
    
	<h1>Parent Account</h1>
	<force:inputField value="{!v.account.ParentId}"/>
</aura:component>
doInit in the controller just gets an account from an Apex controller and sets the result to the attribute with `cmp.set('v.account', account)`.

Regarding my second question, as soon as I add a force:inputField to a context-aware lightning component (one implementing the force:hasRecordId interface) and bound to the Name field of an Account loaded with force:recordPreview my component renders completely blank, the Chrome debugger not pausing on any (even caught) JavaScript exceptions.

I also found some reports of other issues with force:inputField.
Greg_ThomsonGreg_Thomson
@Radoslav,

You are hitting a wall that is common amongst all Lightning developers right now.  If you need a lookup input, for example, you currently have to build it out completely on your own with custom components.

We at Lightframe are currently working on a set of components to fill the gaps that Lightning has, and a lookup input is exactly one of those components.

Greg Thomson
Lightframe.co