- 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:20 AM
Hi @sarika ponnagan ,
update script include script as
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'
});
and client script as
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
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