I need some advice -
Aim – to make a custom field visible on the activity but it should only be visble to someone’s Profile
Can this be done ?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
ROLES in Salesforce are used to govern which RECORDS a user can see, and PROFILES are used for PERMISSIONS (over object types, fields etc.)
It isn't common, or pre-built, to control a specific field access based on a users role. It would be more appropriate to use a different profile and field-level-security (or page layout assignment) to do this.
If you post your overall case scenario, I'd be happy to reconsider this notion if it does not apply!
You could create a permission set specifically giving access to those fields, this will allow you to grant access independant of a certain profile.
With a trigger on the User record, you can add the permission set to the user based on the UserRoleId (or query for the role's developername), doing so for the the required role(s).