- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 08:34 AM
In my PDI script Include is not running, while i verified in background script the code is working fine, Created script include and added script include in on change client script, the script include itself not working in my PDI, may i know the reason behind this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 09:28 AM
@sarika ponnagan Try this
var Ifuserismanager = Class.create();
Ifuserismanager.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isUserManager: function() {
gs.log("checking the manager");
var userId = this.getParameter('sysparm_user_sys_id');
var grReportee = new GlideRecord('sys_user');
grReportee.addQuery('manager', userId);
grReportee.setLimit(1);
grReportee.query();
if (grReportee.next()) {
gs.log("user is manager");
return true;
}
gs.log("user is not a manager");
return false;
},
type: 'Ifuserismanager'
});
✔️ If this solves your issue, please mark it as Correct.
✔️ If you found it helpful, please mark it as Helpful.
—
Shubham Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 09:58 AM
Hi @sarika ponnagan ,
Have you tried the scripts I have shared?
update the scripts as follows
script include
var Ifuserismanager = Class.create();
Ifuserismanager.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isUserManager: function() {
gs.info("checking the manager");
var grReportee = new GlideRecord('sys_user');
grReportee.addQuery('manager', this.getParameter('sysparm_user_sys_id'));
grReportee.setLimit(1);
grReportee.query();
return grReportee.hasNext();
},
type: 'Ifuserismanager'
});
client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('Ifuserismanager');
ga.addParam('sysparm_name', 'isUserManager');
ga.addParam('sysparm_user_sys_id', newValue);
ga.getXMLAnswer(function(answer) {
alert(answer + ' typeof answer ' + answer);
});
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 10:00 AM
@sarika ponnagan Just replied to your previous response with Catalog Client Script.
✔️ If this solves your issue, please mark it as Correct.
✔️ If you found it helpful, please mark it as Helpful.
—
Shubham Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 10:00 AM
@sarika ponnagan Can you check this catalog client script:
var ga = new GlideAjax('Ifuserismanager');
ga.addParam('sysparm_name', 'isUserManager');
ga.addParam('sysparm_user_sys_id', g_user.userID);
ga.getXMLAnswer(function(response) {
console.log("Is user a manager? " + response);
});
✔️ If this solves your issue, please mark it as Correct.
✔️ If you found it helpful, please mark it as Helpful.
—
Shubham Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 09:57 AM
Does the logged-in user have access via ACL? Can you pls check if this Script Include's ACL allows the logged-in user to call it?
Regards,
Madhav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 09:01 AM
Hello @sarika ponnagan
Ensure the Script Include is marked as Client Callable.
Use GlideAjax properly in your client script.
Clear browser cache or re-save the script to refresh.
Verify user roles if accessing restricted data.
Try to add some log statements in start of Script Include, so you will get to know if it is getting called or not.
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.