Need script include for reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2024 04:27 AM
Hi ,
We have a requirement to amend the existing reference qualifier which is called frpm script include.
We have Business unit approval variable on the catalog form which refers from sys_user table. and those business approvals should be the same from requestedp_for's business unit which is also referring from sys_user table.
For example:
there is a user called "test user"
and he has business unit as "Finance"
we have approvers in the business unit "finance" and if the requested_for has the business unit as finance , only thos approvers should be visible in the list.
Attaching the images for reference.
Here already we have the script for the above , but we are getting all the active and inactive users in the approval list.
We only need to get the users who are active only.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2024 06:50 AM - edited ‎01-08-2024 04:33 AM
Hello there,
If I correctly understand this, then you need an active records check before returning.
Would that work?
costCenterRefQualifier: function() {
var finalQryStr = '';
var bu = current.variables.u_requested_for.u_business_unit;
if (!gs.nil(bu)) {
var approverRecords = new GlideRecord('sys_user');
approverRecords.addActiveQuery();
approverRecords.addQuery('sys_id','IN',bu.u_business_unit_approvers);
approverRecords.query();
var approvers = [];
while (approverRecords.next()) { approvers.push(approvers.getUniqueValue()); }
finalQryStr = approvers.join(',') + '^sys_id!=' + gs.getUserID();
}
return 'sys_idIN' + finalQryStr;
},
Regards, Ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2024 12:01 AM
Hi @Ivan Betev ,
yes , you are right , it should return only the active users as approvers.
I tried using the above script but its not working.
The script not returning any values , the field showing as empty.
please find the attached snap.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2024 04:34 AM - edited ‎01-08-2024 04:36 AM
Hi @ Vamsi Krishna ,
I've updated the script because I found a tiny typo there. Could you try again?
Could you please paste a screenshot of a ref qualifier field?
Regards, Ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2024 01:43 AM