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
louisa barrett 7louisa barrett 7 

Controlling picklist on VF page with read only FLS

Hi,
I have a vf page which has several page block tables on all with inline edit support enabled. Within the tables there are controlling(Product_Category__c) and dependent(Make__c) picklists. My issue is that the the controlling picklist has a FLS of read only as it is set via a trigger, when I put this field onto the vf page, I get the error of 'The inline edit-enabled dependent picklist 'Make' requires its controlling field 'Product Category' to be present on the page.' when a profile other than system admin views the page. If I remove the read only flags from the FLS and set it at a page layout level, the user can then view the vf page, but the controlling field becomes editable.
Does anyone have any suggestions how I can get around this?

This is my vf page.  I have several pageblocktables within the page, but I've removed all but one for ease of reading.

Many thanks for any help
<apex:page standardController="Account" extensions="SiteSurvey"> 
    <apex:form >        
        <apex:pageBlock id="Block1" title="Active assets for {!Account.Name}" >
            <apex:panelGrid columns="2">
                <apex:commandButton value="View as PDF" action="{!printAsPDF}"/>
                <apex:commandButton value="View as xls" action="{!printAsXLS}"/>
            </apex:panelGrid>
            <apex:pageBlockButtons >
                <apex:commandbutton value="Save" action="{!updateAssets}" id="saveButton" style="display:none"/>
                <apex:commandButton value="Cancel" action="{!cancelAssets}" id="cancelButton" style="display:none"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection id="tsSection" collapsible="true" title="Touchscreens [{!TouchscreenAssets.size}]" columns="1" rendered="{!TouchscreenAssets.size >0}" >
                <apex:pageBlockTable value="{!TouchscreenAssets}" var="a" style="table-layout:fixed">
                    <apex:column headerValue="Asset Name:">
                        <apex:outputLink value="/{!a.ID}" target="_blank">
                            {!a.Name}
                        </apex:outputLink>
                    </apex:column>
                    <apex:column headerValue="Contract Status">
                        <apex:outputField value="{!a.Service_Contract_Status__c}"/>
                    </apex:column>                 
                    <apex:column headerValue="Category">
                        <apex:outputField value="{!a.Product_Category__c}" />
                    </apex:column>
                    <apex:column headerValue="Make" >
                        <apex:outputField value="{!a.Make__c}"/>
                    </apex:column>
                    <apex:column headerValue="Model" >
                        <apex:outputField value="{!a.Model__c}"/>
                    </apex:column>
                    <apex:column headerValue="OS" >
                        <apex:outputField value="{!a.Operating_System__c}"/>
                    </apex:column>
                    <apex:column headerValue="Location #" >
                        <apex:outputField value="{!a.Location_Number__c}"/>
                    </apex:column>
                    <apex:column headerValue="IP" >
                        <apex:outputField value="{!a.IP_Address__c}"/>
                    </apex:column>
                    <apex:column headerValue="User Name" >
                        <apex:outputField value="{!a.User_Name__c}"/>
                    </apex:column>
                    <apex:column headerValue="Password" >
                        <apex:outputField value="{!a.Password__c}"/>
                    </apex:column>
                    <apex:column headerValue="Drawer" >
                        <apex:outputField value="{!a.Drawer_Type__c}"/>
                    </apex:column>
                    <apex:column headerValue="Network" >
                        <apex:outputField value="{!a.Network_Communication__c}"/>
                    </apex:column>
                    <apex:column headerValue="Comms" >
                        <apex:outputField value="{!a.Communication_Method__c}"/>
                    </apex:column>
                    <apex:column headerValue="Prox" >
                        <apex:outputField value="{!a.Prox_Type__c}"/>
                    </apex:column>
                    <apex:column headerValue="Desc" >
                        <apex:outputField value="{!a.Description}" style="white-space:normal"/>
                    </apex:column>
                    <apex:inlineEditSupport event="onClick" showOnEdit="saveButton, cancelButton"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            <script> 
            twistSection(document.getElementById('{!$Component.Block1.tsSection}').getElementsByTagName('img')[0])
            </script>
      </apex:pageBlock>
    </apex:form>
</apex:page>

 
AJAY KRISHNA RAJAY KRISHNA R
Hi,
From what I understand (Please correct me if I am wrong) you don't want the users to edit the Controlling field i.e Product_Category__c but should be able to edit dependent field i.e  Make__c. Please consider the workaround I am not 100 % sure it may solve your issue but it's worth a try.

Give the style to the <apex: column> to restrict any button clicks or events with mouse thus disabling the inlinedit for that specific field alone.
Example :

<apex:column headerValue="Category" style="cursor: not-allowed;pointer-events: none;" >
       <apex:outputField value="{!a.Product_Category__c}" />
   </apex:column>

Thanks and Regards
Ajay Krishna R
louisa barrett 7louisa barrett 7
Hi,

That worked perfectly for the column on the page, but unfortunately the controlling field (Product_Category__c) is still editable on the pop up dialog that appears when you click one of the dependent picklists. Is there anyway to make it read only on that dialog?

Many thanks