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
Sumitsing Ingle 15Sumitsing Ingle 15 

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 ?
vignesh sethuramalingam 17vignesh sethuramalingam 17
Hi Sumitsing,

Did you get any solution fot this issue?.
I am also facing the same issue. Please let me know if you get any solution or workaround .
For me the above code is not working in both developer and Sandbox org.
Kindly let me know if the above code is working for you in your developer org.

Thanks in advance.

Vignesh





 
Bhuvan PashamBhuvan Pasham
Same issue even in Summer 16. Doesn't work in Development org either. Wondring if there is any solution or workaround?
Oussama Lasfar 6Oussama Lasfar 6
Hello,

The picklists and Multi picklists field ar not supported in lightning.

Workaround:
public Static List<String> GetFieldPikclistValues(String ObjectApi_name, String picklistField)
    {
        Schema.SObjectType targetType = Schema.getGlobalDescribe().get(ObjectApi_name);
        Sobject Object_name = targetType.newSObject();
        Schema.sObjectType sobject_type = Object_name.getSObjectType();
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
        List<Schema.PicklistEntry>  controllingFieldValues = field_map.get(picklistField).getDescribe().getPickListValues();
        list<String> values =  new  list<String>();
        for (Schema.PicklistEntry pklVal : controllingFieldValues){
            values.add(pklVal.getValue());  
        }
        return values;
    }

Hope this helps you !
Anshul Jain 33Anshul Jain 33
Creating Picklist in Aura:-

<aura:attribute name="accountList" type="Account[]" />
<ui:inputSelect aura:id="account" label="Select Account" 
                              labelClass="slds-form-element__label" value="{!v.newContact.AccountId}"
                              required="true">
                  <aura:iteration items="{!v.accountList}" var="LinkedAcc">
                      <ui:inputSelectOption text="{!LinkedAcc.Id}" label="{!LinkedAcc.Name}"/>

                  </aura:iteration>    
                  
              </ui:inputSelect> 

where accountList is loaded with Account list.
Phuc HuynhPhuc Huynh
Hi Sumitsing Ingle 15
I saw wrong syntax of you in your code
Wrong:
<aura:component > <aura:attribute name="conObj" type="Contact" default="sobjectType:'Contact'}"/> ​
<force:inputField value="{!v.conObj.Salutation}" aura:id="pic"/> </aura:component>
Right:
<aura:component > <aura:attribute name="conObj" type="Contact" default="{'sobjectType':'Contact'}"/>
​ <force:inputField value="{!v.conObj.Salutation}" aura:id="pic"/> </aura:component>
You need focus in attribute "Default" of aura:component