- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 09:12 AM
Hi,
Does anyone know of a quick way we can report on users who have 2 or more assets assigned to them?
I can get a list of the users but just to know who have 2 or more assets.
Any ideas? What is the best way?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2020 01:17 AM
Hi,
To get it to work your source table isUsers [sys-user] and under related list conditions select Asset -> Assigned to and change the Greater than or Equal to to 2
Hope this helps
Please mark correct or helpful.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 09:24 AM
Have you referred this KB? https://hi.service-now.com/kb_view.do?sysparm_article=KB0716330

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 09:36 AM
Hi Riaz,
Follow below steps.
1. Create a Script include: getassetsforusers
var getassetsforusers = Class.create();
getassetsforusers.prototype = Object.extendsObject(AbstractAjaxProcessor, {
findUserswithMoreThan1Assets: function() {
var count = 0;
var myGroups = [];
var assetsare = '';
var grusersare = [];
var assetis = new GlideRecord("sys_user");
assetis.query();
while (assetis.next()) {
assetis = assetis.sys_id + '|' + assetis;
}
grusersare = assetis.split('|');
for (var i = 0; i < grusersare.length; i++) {
var idis = grusersare[i].toString();
var moreassets = new GlideRecord("alm_hardware");
moreassets.addQuery("assigned_to", idis);
moreassets.query();
if (moreassets.getRowCount() > 1) {
myGroups.push(idis.toString());
count++;
}
}
return myGroups;
},
type: 'getassetsforusers'
});
Once done create a report on User Table as below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 09:47 AM
Thanks Jaspal, I will give this a try later and update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 12:21 PM