You need to sign in to do that
Don't have an account?
Paul H 5
Implement an Apex trigger to enforce field-level security on a custom field based on the User’s profile and User's Role
I tried to implement the above scenarios ,I wanted to know is there any settings in user profile I need to do or this is possible by creating new profile..Help me with the solutions ..Thank you
To enforce field-level security on a custom field based on the User's profile and User's Role in Salesforce, you first need to
> Create a new Profile or edit an existing Profile that you want to enforce field-level security on.
> In the Profile settings, navigate to the "Field-Level Security" section, find the custom field you want to enforce security on and set the appropriate access level (Read, Edit, or Hidden) for the Profile.
> Apex trigger to enforce field-level security: Replace 'YourProfileId' and 'YourRoleId' with the actual Profile Id and Role Id that you want to enforce the field-level security for.
Related:
https://developer.salesforce.com/forums/?id=9060G0000005hnvQAA
https://salesforce.stackexchange.com/questions/164687/class-security-by-user-profile
https://help.salesforce.com/s/articleView?id=sf.code_package_security.htm&type=5
If this information helps, please mark the answer as best. Thank you