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
sudhirn@merunetworks.comsudhirn@merunetworks.com 

Button visible only for specified role

Hi, 

  Have created a button on page layout which call's visualforce page. I need to authorize this button to only one role who have this role can only see this button please suggest me how to enable / disable this button

Thanks
Sudhir
snookiesnookie
Hi Sudhir - 

That would not be possible on standard page layout. Better approach would be to put a JS filter on click of button for role varification. If it matches, redirect to new page else throw a JS error.
sudhirn@merunetworks.comsudhirn@merunetworks.com

How to put this JS filter condition please give me a example and how to achive this feature 

 

Thanks
Sudhir

snookiesnookie

if(loggedinuser.Role == 'XYZ'){
redirect to vf page
}
else{
alert('you are not authorized to use this');
}


this is sudo code. lemme know if you need proper JS code.