You need to sign in to do that
Don't have an account?

Dependent Picklist is required but Picklist doesn't have any value
Hi All,
How do I save the dependent picklist with no value even though it is required using Apex.
Below is my visualforce page and controller code:
oth Country__c and State__c fields are required fields in field definition. The above code gives error "Required fields missing : [State]" incase of countries with no states values.
How do I save the dependent picklist with no value even though it is required using Apex.
Below is my visualforce page and controller code:
<apex:pageBlockSection title="Content Section" columns="1"> <apex:pageBlockButtons > <apex:commandButton action="{!SaveRecord}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:inputField id="Street__c" label="Street " value="{!Street__c}"/> <apex:inputField id="City__c" label="City " value="{!City__c}"/> <apex:inputField id="State__c" label="State " value="{!State__c}"/> // dependent field <apex:inputField id="Country__c" label="Country " value="{!Country__c}"/> //controlling field </apex:pageBlockSection> //Controller public class Test{ public Test(ApexPages.StandardController sc) { obj = (TestAccount__c) sc.getRecord(); } public ApexPages.PageReference SaveRecord() { try{ insert obj; PageReference pr = new PageReference('/' + Obj.id); return pr; } catch (Exception e){ System.debug(LoggingLevel.ERROR, e.getMessage()); ApexPages.addMessages(e); return null; } } }
oth Country__c and State__c fields are required fields in field definition. The above code gives error "Required fields missing : [State]" incase of countries with no states values.
The issue you are facing seems related to know issue: https://trailblazer.salesforce.com/issues_view?id=a1p3A0000001C3VQAU&title=required-dependent-picklists-show-as-required-even-though-they-are-in-a-disabled-state-no-values-in-lightning
Can you check if this behaviour is specific to lightning experience or happens in the classic too?
If this information helps, please mark the answer as best.Thank you
Thank you. This happens for me in classic as well for the above code. Is there any workaround for this?