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
Pat Harris 8Pat Harris 8 

I'm trying to get the date in a SOQL query but contine to get an error...

I'm trying to get the date in a SOQL query but contine to get an error...
I'm not a developer btw. Here is the query:
"​​​​​Select Assignee.Id, Assignee.Name,  PermissionSetLicense.MasterLabel 
From PermissionSetLicenseAssign
Where PermissionSetLicense.MasterLabel in ('Salesforce CPQ License')"
Best Answer chosen by Pat Harris 8
Maharajan CMaharajan C
Hi Pat,

If i am correct you can use the CreatedDate field of PermissionSetLicenseAssign record which will help you to found the date when CPQ license was assigned. At the time of license assignment only the PermissionSetLicenseAssign record will be created so you can use the CreatedDate field as assigned date.
 
Select Assignee.Id, Assignee.Name,  PermissionSetLicense.MasterLabel,CreatedDate  
From PermissionSetLicenseAssign Where PermissionSetLicense.MasterLabel in ('Salesforce CPQ License')

Thanks,
Maharajan.C

All Answers

Suraj Tripathi 47Suraj Tripathi 47

Hi Harris,

Please find the solution.

Admins are welcome to copy and paste the following SOQL queries into the Developer Console to view a list of PSL assignments for each package:

Salesforce CPQ
select Assignee.Id, Assignee.Name, PermissionSetLicense.MasterLabel from PermissionSetLicenseAssign
Where PermissionSetLicense.MasterLabel in ('Salesforce CPQ License')

Advanced Approvals
select Assignee.Id, Assignee.Name, PermissionSetLicense.MasterLabel from PermissionSetLicenseAssign
Where PermissionSetLicense.MasterLabel in ('Salesforce CPQ AA License')

OR

Please follow the steps mentioned below :
Go to the Developer Console
To open the Developer Console from Salesforce Classic:
1. Click Your Name.
2. Click Developer Console.

To open the Developer Console from Lightning Experience:
1. Click the Setup gear icon.
2. Click Developer Console.
 
Click on the Query Editor tab towards the bottom left 
Copy and paste the following query in the Developer Console:
"SELECT Name, Id FROM User WHERE Id IN (SELECT AssigneeId FROM PermissionSetLicenseAssign WHERE PermissionSetLicense.MasterLabel ='NAME OF THE PERMISSION SET LICENSE') AND IsActive=true ORDER BY Name" 
Click on Execute.
This will display a list of every ACTIVE user along with their internal Id, who have that license. If you would want to view the assigned license(s) of INACTIVE users, you would need to replace the "IsActive=true" with "IsActive=false"

Note: If you are not sure about the name of the licenses, please get the name from under permission set license assigned from company information. 

If your query is solved then don't forget to mark it as the Best Answer.

Thank You
 

Pat Harris 8Pat Harris 8
Thanks but I got my query from the help that you noted. Msaybe I wan't clear enough.
I want to see the date that CPQ license was assigned. looking for what I would use to get that; tried "Assignee.Date" and "Date.Assignee', neither worked, got an error for both. Does anyone know the synntax to get the date assigned?
Andrew GAndrew G
If my understanding is correct, PermissionSetLicenseAssign is a joining object between PermissionSetLicense and User.  Therefore the creation date of the record is the date that it is assigned. 

PermissionSetLicenseAssign | SOAP API Developer Guide | Salesforce Developers (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_permissionsetlicenseassign.htm)

I would do some tests to confirm, but use Created Date

regards

Andrew
  
Maharajan CMaharajan C
Hi Pat,

If i am correct you can use the CreatedDate field of PermissionSetLicenseAssign record which will help you to found the date when CPQ license was assigned. At the time of license assignment only the PermissionSetLicenseAssign record will be created so you can use the CreatedDate field as assigned date.
 
Select Assignee.Id, Assignee.Name,  PermissionSetLicense.MasterLabel,CreatedDate  
From PermissionSetLicenseAssign Where PermissionSetLicense.MasterLabel in ('Salesforce CPQ License')

Thanks,
Maharajan.C
This was selected as the best answer
Pat Harris 8Pat Harris 8
Hi Maharajan,

Thanks for the responding and the screenshot. It worked.