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 

How to Add/Remove UserLicense to User from SOAP API request?

What API requests we can use to Add UserLiecnse to user or to Remove UserLicense Assigned to User?
AnudeepAnudeep (Salesforce Developers) 
Hi Bhushan, 

As answered in this post, there is a Userlicense object to store all the user licenses available in the org. While using SOAP API's, first you will have to query this object and get the related ID.

The relationship between user and license is via Profiles

User -> Profile -> Userlicense

So if you want to update the User license, you will have to follow below approach
  1. Query license ID
  2. Query available profileID for the license
  3. Update user with that profileID
See this post for sample queries

Let me know if this helps

Thanks, 
Anudeep
 
Bhushan burujwaleBhushan burujwale
Thanks for your prompt reply Anudeep.

Does that means we will be updating the profile as well while updating UserLicenses as Profiles are dependent from UserLicenses?