We have a simple Visualforce page that we only want to display for the "Photonics Users" profile. Here is the code:
<apex:page standardcontroller="OpportunityLineItem" >
<font size="3" color="red">If you need to make changes to products, please go to the primary quote that is related to this opportunity and click the Edit Lines button.</font>
</apex:page>
I saw something online about how we can add something like this to have it only work for certain profiles:
rendered="{!$Profile.Name = 'Your Profile Name'}"
But I am not sure how to add this to the existing VF page code. Can someone add this one extra line of code to my existing VF page so I can see how it is done?
Hi Andy Shelton,
You can make use of below code based on profile name.
<apex:page standardcontroller="OpportunityLineItem" lightningStylesheets="true">
<!-- Developer Name - Prafull Jain -->
<!-- Developer Email Id - prafulljaincp@gmail.com -->
<!-- Initial Modified Date - 14/07/2021 -->
<!-- Initial Version - 1.0.0 -->
<style>
<!-- For Hiding Tab Panel Label
.rich-tab-bottom-line {
display:none;
} -->
</style>
<apex:tabPanel switchType="client">
<apex:tab label="Standard Platform User Page" rendered="{!$Profile.Name ='Standard Platform User'}">
<font size="3" color="red">For Standard Platform User :- If you need to make changes to products, please go to the primary quote that is related to this opportunity and click the Edit Lines button.</font>
</apex:tab>
<apex:tab label="System Admin" rendered="{!$Profile.Name ='System Administrator'}">
<font size="3" color="red">For System Admin :- If you need to make changes to products, please go to the primary quote that is related to this opportunity and click the Edit Lines button.</font>
</apex:tab>
<apex:tab label="For All of them">
<font size="3" color="red">For All the User :- If you need to make changes to products, please go to the primary quote that is related to this opportunity and click the Edit Lines button.</font>
</apex:tab>
</apex:tabPanel>
</apex:page><apex:page standardcontroller="OpportunityLineItem" lightningStylesheets="true">
<!-- Developer Name - Prafull Jain -->
<!-- Developer Email Id - prafulljaincp@gmail.com -->
<!-- Initial Modified Date - 14/07/2021 -->
<!-- Initial Version - 1.0.0 -->
<style>
<!-- For Hiding Tab Panel Label
.rich-tab-bottom-line {
display:none;
} -->
</style>
<apex:tabPanel switchType="client">
<apex:tab label="Standard Platform User Page" rendered="{!$Profile.Name ='Standard Platform User'}">
<font size="3" color="red">For Standard Platform User :- If you need to make changes to products, please go to the primary quote that is related to this opportunity and click the Edit Lines button.</font>
</apex:tab>
<apex:tab label="System Admin" rendered="{!$Profile.Name ='System Administrator'}">
<font size="3" color="red">For System Admin :- If you need to make changes to products, please go to the primary quote that is related to this opportunity and click the Edit Lines button.</font>
</apex:tab>
<apex:tab label="For All of them">
<font size="3" color="red">For All the User :- If you need to make changes to products, please go to the primary quote that is related to this opportunity and click the Edit Lines button.</font>
</apex:tab>
</apex:tabPanel>
</apex:page>
Please mark it as best answer, If your issue is resolved.