Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

We have a managed package that requires a license. We've purchased enough licenses for our entire company (2,500+ users). Assuming I know the SELECT statement that will get me a list of all these users, is there a way I can grant this license to all of these users via either Anonymous Apex or through the Data Loader? Additionally, how can I ensure that all new users who meet this same criteria are granted this license automatically going forward?

share|improve this question

3 Answers 3

Unfortunately there is no API exposed to make writing a tool to do this possible. An idea has been raised for this very use case.

Expose API / Objects for assigning Managed Package Licenses to Users

Currently the only way to assign a Seat License of an installed Managed Package to a particular user is through the Setup user interface --- there is no API or object which would allow a customer to programmatically assign licenses of an installed Managed Package to particular users.

Read more here.

Where there is a will there is a way...

Well in the spirit of never say never... there is the option of scripting the user interface using something like WebDriver (from the Selenium) world. In theory something like this could be developed to work its way through users that meet certain criteria.

share|improve this answer

I actually just solved my own problem. Well, at least the problem of getting existing users licensed. There is an "Add All Users" button, which at first glance I assumed would simply add the users that were currently visible, but after some fiddling I realized it will add all the users in whichever view you have selected, regardless of whether they are on the screen or not. So I created a view that contained the users to whom I wanted to grant licenses, then clicked the button. Voila! 2,500+ licenses quickly and painlessly assigned.

enter image description here

I still have the task of assigning the licenses to new users, but there is already a certain amount of manual process we go through for all new employees, so, in the absence of any way to script this in a workflow or trigger, we'll just have to add that to the rest of our manual new hire standard operating procedure.

share|improve this answer

PermissionSetAssigment object supports create() call, so build a permissions set with your requirments and get all user ID's which need to have that particluar permission set.

select Id, PermissionSetId, AssigneeId, SystemModstamp from PermissionSetAssignment.

If it gives an error:CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, then we cannot do it this way.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.