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
Jyoti Ranjan PandaJyoti Ranjan Panda 

We would like to know on which date license was modified.

We would like to know on which date license was modified.

Ex : Ram was assigned license on 1st Jan and revoked on 1st April and again assigned license on 3rd May .How to get the details that license was changed on 3rd May .
Tried with below query but output is record modified date
SELECT Name,Email,CreatedDate,LastModifiedDate,LastModifiedById FROM User where profileid='00e5j000000mjum' and IsActive=true order by LastModifiedDate DESC.

Please help .
Eswar Venkat 2Eswar Venkat 2
SELECT Id, CreatedDate, UserLicenseId
FROM UserLicenseHistory
WHERE UserId = '005xxxxxxxxxxxx' -- Replace with Ram's user ID
ORDER BY CreatedDate DESC
LIMIT 1
 
SwethaSwetha (Salesforce Developers) 
HI Jyoti,
You can make use of the Setup Audit Trail to figure out the license change details.

Similar ask: https://salesforce.stackexchange.com/questions/324869/how-to-see-the-date-that-salesforce-license-was-assigned-to-an-user

Alternately, you can try creating a custom report type to see User License Assignments 

If this information helps, please mark the answer as best. Thank you
Jyoti Ranjan PandaJyoti Ranjan Panda
Hi Eswar,
Thanks for the update .
Requirment over here is to have the UserLicenseHistory of all users using Community License.
Kindly share the query to extract the data .
Jyoti Ranjan PandaJyoti Ranjan Panda
This query is not working as I am not able to view any object UserLicense History in Workbench
SELECT Id, CreatedDate, UserLicenseId
FROM UserLicenseHistory
WHERE UserId = '005xxxxxxxxxxxx' -- Replace with Ram's user ID
ORDER BY CreatedDate DESC
LIMIT 1