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
LATHA RAJLATHA RAJ 

VF list view button access to certain user

Hi ,

I have list view custom button build using VF , can we restrict that button for only certain users? please advice
NagendraNagendra (Salesforce Developers) 
Hi Latha,

Sorry for this issue you are encountering.

Visualforce would not allow you to modify a list view directly. 
 
You can create a custom field, formula field, on the object itself.  This formula would show a link if the profile matched the one you wanted, and show something else otherwise.

Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
SandhyaSandhya (Salesforce Developers) 
Hi,

Refer below salesforce help article which has the solution for the same.

https://help.salesforce.com/articleView?id=000188475&type=1

 
https://help.salesforce.com/articleView?id=000002488&type=1

Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
 
Shruti SShruti S
I don't think you can do that. However you could do this -
<apex:page ......>

    <apex:outputPanel layout="none" rendered="{!$Profile.Name == 'System Administrator'}">

        <!--Enitire Page Markup-->

    </apex:outputPanel>

    <!--Error Message for Unauthorized Users-->
    <apex:outputPanel layout="none" rendered="{!$Profile.Name != 'System Administrator'}">

        <apex:pageMessage   severity="ERROR"
                            strength="3"
                            title="Unauthorized Access"
                            summary="You do not have permissions to access this page.">
        </apex:pageMessage>
    </apex:outputPanel>

</apex:page>