+ Start a Discussion
Shanmugapriya Murugandurai 6Shanmugapriya Murugandurai 6 

The dependent picklist 'Dependentfield' requires its controlling field 'Controllingfield' to be present on the page.

In a custom object I have a dependent picklist, and I have provided field level access(read/write) through permission sets. If i provide Read&write permission for Dependent field and only Read permission permission for Controlling field, I got the below error while loading the page.

ERROR: "The dependent picklist 'Dependentfield' requires its controlling field 'Controllingfield' to be present on the page."

Can anyone tell is this is the standard behaviour of salesforce or i need not do anything to make it work fine?

Thanks in advance.
Sri549Sri549
Hello Shanmuga,
Yes this is a standard behaviour.Please add the Controlling field as like Depending Field. So that error will be resolved.

Thanks
Srinivas
 
Shanmugapriya Murugandurai 6Shanmugapriya Murugandurai 6
Hi sri,

Thanks for the reply, but I need that controlling field should not be editable, in my scenario
 
Sameer Tyagi SFDCSameer Tyagi SFDC
Hi Shanmugapriya, 

Are you getting this error on Standard page of Salesforce or Visualforce page?

Regards,
Sameer Tyagi.
http://mirketa.com/

 
Shanmugapriya Murugandurai 6Shanmugapriya Murugandurai 6
Hi Sameer,

I am getting this error on Visualforcepage(Custom page)

Thanks,
Priya
Sameer Tyagi SFDCSameer Tyagi SFDC
Try this. 

Please try this. 
First you need to initialize your Controlling field value in your controller in Constructor. 

public objname obj = new objname();
public String str {get ; set}
Public classconstructor {
 obj = new objname();
obj.Controllingfield = 'Any Value';
str  = obj.Controllingfield
}

<apex:inputField value="{!obj.Controllingfield}"  style="display:none; />  
<!--You can show Str value here with label if you want -->
<apex:inputField value="{!obj.Dependentfield}"   /> 


Sameer Tyagi

  
 
Shanmugapriya Murugandurai 6Shanmugapriya Murugandurai 6
Controlling field is a Mandatory field. And I am getting the error while click on "Edit". So it means that the controlling field contains a value in it. 

Thanks,
Priya
Sameer Tyagi SFDCSameer Tyagi SFDC
Hi Priya, 

Have you tried above sample code above?

If that does not work, Can you please share your sample code So that I can try more to fix it?

Sameer
Shanmugapriya Murugandurai 6Shanmugapriya Murugandurai 6
Hi,
 I found that there is a salesforce limitation, the limitation is

"​If the user viewing the page has read-only access to the controlling field, a dependent picklist might not behave as expected. In this case, the dependent picklist shows all possible values for the picklist, instead of being filtered on the read-only value. This is a known limitation in Visualforce"

Referred in "​https://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_dependent_picklists.htm".

Now my problem got solved. The solution is we need to provide read&write permission for a controlling field, if the dependent field is present on the page with read&write permission.

Thanks everyone.
Srikanth sandireddy 6Srikanth sandireddy 6
Hi Shanmugapriya Murugandurai 6

Without adding dependent also its working fine in salesforce classic view its not working in lightning view can u pls help
mohd areeb 8mohd areeb 8
Hello Sameer Tyagi SFDC,
i have tried your still not working please help me out as i do not want to show dependent picklist