Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 07:11 PM
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
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 08:46 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
20 REPLIES 20
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 02:55 AM
This is working now by providing access to the referenced table. Thank you.