- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 06:22 AM - edited 11-14-2022 06:24 AM
hello Experts!
need help on advanced reference qualifier
scenario :- I've two variables in normal change record producer "requested for" "service offering",
service offering is dependent upon requested for service offering shows the serivces subscribed by requested for
i've written a reference qualifier it is working fine connected with service offering field but its not picking the
requested for value, when I hard code requested by its worked fine but its not picking it on its own
Record Producer
reference qualifier
Script include
var cd_serviceOffering_re_qual = Class.create();
cd_serviceOffering_re_qual.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getOfferings: function(USerString) {
//requested for's company
var grZero = new GlideRecord('sys_user');
grZero.addQuery('sys_id', current.u_requested_for);
grZero.query();
if (grZero.next()) {
var company = grZero.company;
var requestedFor = grOne.sys_id;
}
//company
var grOne = new GlideRecord('service_subscribe_company');
grOne.addQuery('core_company', company);
grOne.query();
if (grOne.next()) {
serviceOferrings = grOne.service_offering + ',';
}
//group
var grTwo = new GlideRecord('sys_user_grmember');
grTwo.addQuery('user', requestedFor);
grTwo.query();
while (grTwo.next()) {
var grThree = new GlideRecord('service_subscribe_sys_user_grp');
grThree.addQuery('sys_user_group', grTwo.group);
grThree.query();
while (grThree.next()) {
serviceOferrings = serviceOferrings + ',' + grThree.service_offering;
}
}
return 'sys_idIN' + serviceOferrings;
},
type: 'cd_serviceOffering_re_qual'
});
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 10:11 PM
Hi @Aditya Kumar ,
As far I understand, you are not passing any parameter within the function for to be able to be fetched in the script include. Could you try passing the parameter in the reference qualifier as:
javascript: new cd_serviceOffering_re_qual.getOfferings(current.variables.requested_for);
current doesn't essentially work in script include, for more details refer to below doc:
https://snprotips.com/blog/2019/12/18/can-script-includes-use-the-current-variable
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 06:46 AM - edited 11-14-2022 06:48 AM
In your reference qualifier, where you are calling the getOffering function, you need to pass in your parameter USerString. Also in your addQuery, your need to replace current.u_requested_for with USerString
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 09:03 PM
check Userstring is not holding anything from ref qual in service offering variable
i've changed that still its not working
var cd_serviceOffering_re_qual = Class.create();
cd_serviceOffering_re_qual.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getOfferings: function(USerString) {
//requested for's company
var grZero = new GlideRecord('sys_user');
grZero.addQuery('sys_id', USerString);
grZero.query();
if (grZero.next()) {
var company = grZero.company;
var requestedFor = grOne.sys_id;
}
//company
var grOne = new GlideRecord('service_subscribe_company');
grOne.addQuery('core_company', company);
grOne.query();
if (grOne.next()) {
serviceOferrings = grOne.service_offering + ',';
}
//group
var grTwo = new GlideRecord('sys_user_grmember');
grTwo.addQuery('user', requestedFor);
grTwo.query();
while (grTwo.next()) {
var grThree = new GlideRecord('service_subscribe_sys_user_grp');
grThree.addQuery('sys_user_group', grTwo.group);
grThree.query();
while (grThree.next()) {
serviceOferrings = serviceOferrings + ',' + grThree.service_offering;
}
}
return 'sys_idIN' + serviceOferrings;
},
type: 'cd_serviceOffering_re_qual'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 10:11 PM
Hi @Aditya Kumar ,
As far I understand, you are not passing any parameter within the function for to be able to be fetched in the script include. Could you try passing the parameter in the reference qualifier as:
javascript: new cd_serviceOffering_re_qual.getOfferings(current.variables.requested_for);
current doesn't essentially work in script include, for more details refer to below doc:
https://snprotips.com/blog/2019/12/18/can-script-includes-use-the-current-variable
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 11:28 PM
no sir still its not working, current works in script include with ref qual in normal incident or change form