[SalesForce] Lightning Component > force:inputField is not working for picklist in Sandbox

I am working on a lightning component where I want to show picklist field using as follows. `

<aura:component >
    <aura:attribute name="conObj" type="Contact" default="sobjectType:'Contact'}"/>
    <force:inputField value="{!v.conObj.Salutation}" aura:id="pic"/>    
</aura:component>

`

The above code works fine in my developer org but not working on sandbox. When I try to run this by adding in an app throws some exception. Although same component works in same sandbox if I replace inputField with outputField.

Is there any solution for this ?

Best Answer

Please try the below code.formatted syntax

You have missed curly braces for default attribute

<aura:attribute name="conObj" type="Contact" default="{ 'sobjectType' : 'Contact' }"/>
<force:inputField value="{!v.conObj.Salutation}" aura:id="pic"/>   
Related Topic