Script Include is not trigger for non-itil users

Lisa Goldman
Kilo Sage

Hello,

I have a script includes that query 'alm_asset' table to retrieve asset tag. It's working fine as an admin or ITIL user, but when I impersonate an end user with no roles, no data is returned."

 

Could someone please help?  Here is the script include for your review.  Thank you

 

LisaGoldman_0-1696385338955.png

 

 

 

1 ACCEPTED SOLUTION

@Lisa Goldman 

it should be simply this

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

 

isPublic:function(){
return true;
},

getDetails: function() {
var arr = [];
var sysId = this.getParameter('sysparm_sysId');
var gr = new GlideRecord('alm_asset');
gr.addQuery('assigned_to', sysId);
gr.addQuery('asset_tag', '!=', '');
gr.query();
while (gr.next()) {
arr.push(gr.asset_tag.toString());
}
if (arr.length >= 2)
return arr.toString();
// else
// return '';
},

type: 'getAssetTag'
});
Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

20 REPLIES 20

mmr
Tera Contributor

This is working now by providing access to the referenced table. Thank you.