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
prati@salesforceprati@salesforce 

Same vf page to be seen by different users

Hi all
I have overidden a the view of a custom object using a vf page  which has  an apex;chatter component. I have two differnt profiles and both have access to this object and vf page. But for one of the profile, I dont want them to see the chatter feed, but all other tabs and components can be seen. I dont want to deactivate chatter either for that profile because they still need chatter for other objects.
How can this be done?  I thought of using two differnt exactly same vf page and removing chatter from one of them and then crreate a separate vf page just to navigate to that vf page based on the profile condition, but i dont know how to implement it.
Any help would be highly appreciated.
Thank you
Best Answer chosen by prati@salesforce
GauravGargGauravGarg
Hi Pratima,

The best way to conditionally display some components on VF page is using Rendered options on Apex Components, please try below sameple code.
 
<Apex:component rendered="{!if($Profile.Name !='System Administrator',FALSE,TRUE)}" >


Hope this will help you, do let me know if you need more insight on this. 

Thanks,

Gaurav

All Answers

UC InnovationUC Innovation
I think you can just check the profile of the curernt user in the VF page and then turn on/off sections of the VF page based on that.
prati@salesforceprati@salesforce
Thank you for the reply but How can i turn off a  section on  a VF page based on profile?
Can you please elaborate?
GauravGargGauravGarg
Hi Pratima,

The best way to conditionally display some components on VF page is using Rendered options on Apex Components, please try below sameple code.
 
<Apex:component rendered="{!if($Profile.Name !='System Administrator',FALSE,TRUE)}" >


Hope this will help you, do let me know if you need more insight on this. 

Thanks,

Gaurav

This was selected as the best answer
prati@salesforceprati@salesforce
Thank you for your reply Gaurav.
Actually its a chatter component which I dont want to show to for one profile and that chatter component already has a rendered attribute.
<chatter:feedWithFollowers rendered="{!$Setup.ChatterStatus__c.Claim_Chatter__c}" entityId="{!Claim__c.id}"/>.
Can I have multple rendered attribute?
prati@salesforceprati@salesforce
I tried to use a comma and use both the attributes but then it is not showing chatter for anyone.
 
prati@salesforceprati@salesforce
Thank you..that worked
GauravGargGauravGarg
Welcome Pratima...