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
Bhushan burujwaleBhushan burujwale 

Userlicense not found on permission set

I am using following query but its giving me error

select Name, Label, Description, userLicense from PermissionSet
                                 ^
ERROR at Row:1:Column:34
No such column 'userLicense' on entity 'PermissionSet'

But from the documentaion I can see that userLicense is present on the permission set.
Can you please help
NagendraNagendra (Salesforce Developers) 
Hi Bhushan,

Sorry for this issue you are encountering.

The actual field name is userLicenseId.

May I suggest you please give a try by attempting with below SOQL query which should probably do the trick.
select Name, Label, Description, userLicenseId from PermissionSet

User Licenses:

The user license controls the permissions that are available in a permission set.

Every permission set can be associated with a user license or permission set license. If you plan to assign a permission set to multiple users with different user and permission set licenses, leave LicenseId empty. If only users with one type of license will use this permission set, set the LicenseId to that single user or permission set license. If you want a permission set associated with a permission set license, then set LicenseId to the permission set license. To get theLicenseId, run this query:
SELECT Id, Name
FROM UserLicense
Alternatively, to query a user or profile for the LicenseId.
SELECT Id, Profile.UserLicenseId
FROM User
Hope this will help you pass the challenge.

Kindly mark this as solved if it's resolved.

Thanks,
Nagendra



 
Bhushan burujwaleBhushan burujwale
No its not working 
select Name, Label, Description, userLicenseId from PermissionSet
                                 ^
ERROR at Row:1:Column:34
No such column 'userLicenseId' on entity 'PermissionSet'.

Please help