I'm currently trying to check whether or not the user has a permission set within the LWC and it's constantly returning undefined. I've confirmed the API Name and tried with and without the prefix. So far the only way I've got a work around is to create an Apex function that checks the PermissionSetAssignment.

This is the format I've tried used

import hasPermissionBulkUser from '@salesforce/userPermission/Bulk_Positions_User';

Which gives me undefined, I also tried with other PermissionSets and also a few customPermissions and all of them give the same result. Is there some setting I need to flip inside the scratch org to allow LWC to be able to access these?

Here's the format I used for the custom permissions

import hasPermission from '@salesforce/customPermission/Bulk_Positions_Access';

1 Answer 1


You have to assign the custom permission to the permission set, and assign the permission set to the user. The last one you tried should work.

import hasPermission from '@salesforce/customPermission/Bulk_Positions_Access';
  • Thanks, it seems the problem I was having was that I was testing trying to get the custom permission and I didn't realize that if the user didn't have the custom permission it would return undefined (I thought it would return false)
    – Kevin Yao
    Jun 6, 2023 at 18:52
  • Thanks +1, not sure why I cannot check for has user permission directly (Seems easier). But creating custom permission, adding to user permission, and assigning to user, then checking for custom permission did work for me. Nov 30, 2023 at 16:09
  • @JeremyA.West A user's permissions are a combination of their profile, any permission set assignments, and any permission set group assignments. We're discouraged from using Profile names or Permission set names, as that is relative fragile. By assigning a Custom Permission to a user through some mechanism, we only have to check one place to see if the user has a permission or not.
    – sfdcfox
    Nov 30, 2023 at 16:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .