You need to sign in to do that
Don't have an account?
fiona gentry
I see Blank values in dependent picklist using SFDCMonkey Blog
Hi Gurus,
I am trying to fetch dependent picklist values by referring
https://sfdcmonkey.com/2018/08/31/dependent-picklist-lightningselect-lightning-salesforce/
and
https://developer.salesforce.com/forums/?id=9060G0000005pt3QAA
Here is problem as you see I see no drop down value in "Country" controlling field
can some one please help ,in the blog they used contact standard object and here I have used custom object and its API name
which is ERT_Case_Type__c
here is my cmp file
Regards,
Fiona
I am trying to fetch dependent picklist values by referring
https://sfdcmonkey.com/2018/08/31/dependent-picklist-lightningselect-lightning-salesforce/
and
https://developer.salesforce.com/forums/?id=9060G0000005pt3QAA
Here is problem as you see I see no drop down value in "Country" controlling field
can some one please help ,in the blog they used contact standard object and here I have used custom object and its API name
which is ERT_Case_Type__c
here is my cmp file
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="dependentPicklist_UpdateCtrl"> <!-- call doInit function on component load --> <aura:handler name="init" value="this" action="{!c.doInit}"/> <!-- aura attributes--> <aura:attribute name="listControllingValues" type="list" default="[]" description="to store controller field values"/> <aura:attribute name="listDependingValues" type="list" default="['--- None ---']" description="to store dependent field values"/> <aura:attribute name="listSubDependingValues" type="list" default="['--- None ---']" description="to store dependent field values"/> <aura:attribute name="depnedentFieldMap" type="map" description="map to store dependent values with controlling value"/> <aura:attribute name="subDepnedentFieldMap" type="map" description="map to store sub dependent values with controlling value"/> <aura:attribute name="bDisabledDependentFld" type="boolean" default="true"/> <aura:attribute name="bDisabledSubDependentFld" type="boolean" default="true"/> <aura:attribute name="objDetail" type="ERT_Case_Type__c" default="{'sobjectType' : 'ERT_Case_Type__c'}"/> <aura:attribute name="controllingFieldAPI" type="string" default="Level_1__c" description="store field API name of Controller field"/> <aura:attribute name="dependingFieldAPI" type="string" default="Level_2__c" description="store field API name of dependent field"/> <aura:attribute name="subDependingFieldAPI" type="string" default="Level_3__c" description="store field API name of sub dependent field"/> <!--Controller Field--> <lightning:layoutItem size="12" padding="around-small"> <lightning:select name="controllerFld" value="{!v.objDetail.Level_1__c}" label="Country" onchange="{!c.onControllerFieldChange}"> <aura:iteration items="{!v.listControllingValues}" var="val"> <option value="{!val}">{!val}</option> </aura:iteration> </lightning:select> </lightning:layoutItem> <!--Dependent Field--> <lightning:layoutItem size="12" padding="around-small"> <lightning:select name="dependentFld" value="{!v.objDetail.Level_2__c}" label="City" disabled="{!v.bDisabledDependentFld}" onchange="{!c.onSubControllerFieldChange}"> <aura:iteration items="{!v.listDependingValues}" var="val"> <option value="{!val}">{!val}</option> </aura:iteration> </lightning:select> </lightning:layoutItem> <!--sub Dependent Field--> <lightning:layoutItem size="12" padding="around-small"> <lightning:select name="subDependentFld" value="{!v.objDetail.Level_3__c}" label="language" disabled="{!v.bDisabledSubDependentFld}"> <aura:iteration items="{!v.listSubDependingValues}" var="val"> <option value="{!val}">{!val}</option> </aura:iteration> </lightning:select> </lightning:layoutItem> </aura:component>Your help is highly appreciated
Regards,
Fiona
your Depandencies are right. I have checked following code many time on different objects. I am sure this time it's working properly.
I did change object and fields name with your object and fields name. but even then you have to check once api Name.
and this time first of all you should create apex class and then aura Component.
let me know it's working or not. and try this code on another object.
wating of your response
Thank you
All Answers
try this following code.
Please let me know if it's helps you, do mark this answer as best so that others facing the same issue will find this information useful.
JS File
Helper File
Apex
Thank you
Please show me your Dependeinces fields And Object
Thank you
your Depandencies are right. I have checked following code many time on different objects. I am sure this time it's working properly.
I did change object and fields name with your object and fields name. but even then you have to check once api Name.
and this time first of all you should create apex class and then aura Component.
let me know it's working or not. and try this code on another object.
wating of your response
Thank you