[SalesForce] Checking for a Permission Set Apex/JavaScript/Lightning

I am currently trying to check for a user for a permission set. Currently I have a permission set to give view access to a details object page. Users can access page by clicking on a number link on the Account page. I need to be able to check if a user has a permission set before accessing details page. I have created the Permission set and have assigned the correct profiles. I'm aware Perm Sets go off users, but here's were things get tricky. We have a 6.02 profile, there is more then one type of users within that profile. Meaning the 6.02 profile has multiple users each type of user having a different access to read and edit views. If anyone knows what direction to start heading after creating the permission set, that would be great!

Best Answer

You could create a Custom Permission and add it to the Permission Set.

Then in Apex you can check for the custom permission using:

 FeatureManagement.checkPermission('<custom_permission_api_name>')
Related Topic