• Radoslav Atanasov
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
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.