0

Background

We have implemented customer portal for one of our customer where they uses ServiceMax managed package, while creating user we assign ServiceMax licence to the user so that they can access ServiceMax objects. For the few user ServiceMax licence is getting disabled after some time without any intervention.

We have raised case to salesforce and ServiceMax support team, they were not able to trace how the ServiceMax licence is getting disabled. 

Is there anyway how to find ServiceMax users those who are assined to ServiceMax licence in the organisation so that we can keep a count of the user to identify the missing  ServiceMax licence users

Question

Is there a way to build a report or to query users that have this particular license assigned?

1 Answer 1

3

You can run a query in Developer Console, or via Workbench or Apex:

SELECT UserId, PackageLicense.NamespacePrefix FROM UserPackageLicense

If you wish, add a filter on PackageLicense.NamespacePrefix for the namespace(s) used by ServiceNow's managed package.

The object is not triggerable, however, so inspection is what you're left with.

4
  • Hi David, Thanks for the response. Query is working but it is getting all the active and inactive users. I would like to query only active users. i have tried below query it is not working. Is there anyway we can query only active users. SELECT Id,Userid,User.Isactive FROM UserPackageLicense Thanks, Anil Kumar
    – Anil Kumar
    Oct 31, 2018 at 13:12
  • As far as I can tell, there's an implementation restriction on querying through the User relationship on this object. You'd have to do a semi-join IN or run two queries and combine them programmatically.
    – David Reed
    Oct 31, 2018 at 16:12
  • 1
    Hi David, Below code worked for me...String APP_NAMESPACE_PREFIX = 'SVMXC'; List<User> licensedUsers = [ SELECT Name, isactive FROM User WHERE Id in ( SELECT UserId FROM UserPackageLicense WHERE (PackageLicense.NamespacePrefix = :APP_NAMESPACE_PREFIX) ) ]; integer count = 1; System.debug('licensedUsers '+licensedUsers ); for(user u: licensedUsers ){ if(u.isactive= true){ count++; System.debug('Number of users'+u.name); } } System.debug('Number of Active users.....'+count);
    – Anil Kumar
    Nov 2, 2018 at 8:58
  • I run this query in my org but return 0 results. Any idea why that would happen?
    – Daft
    Mar 19, 2021 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .