102 views

Description

You want to fetch data from alm_asset table where users are assigned with more than 1 laptop or more than 1 assets.


Release or Environment

Any Version


Resolution

1) Create a Script Include as below:

var getDuplicateAssignedTo = Class.create();
getDuplicateAssignedTo.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getDuplicateAssetforAssignedTo: function() {
var str = [];
var gr = new GlideAggregate('alm_asset');
gr.addAggregate('COUNT', 'assigned_to');
gr.groupBy('assigned_to');
gr.addHaving('COUNT', '>', 1);
gr.query();
while (gr.next()) {
str.push(gr.getValue('assigned_to') + '');
}
return str.toString();

},
type: 'getDuplicateAssignedTo'
});


2) Create a Report as below:

Additional Information

This article is created from below community link:

https://community.servicenow.com/community?id=community_question&sys_id=3a454eebdb649410190dfb243996195c

Article Information

Last Updated:2020-06-16 02:23:08
Published:2020-06-14