- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 01:04 AM
Hello
I would like to put reference qualifier on field (2)
Based on value from field (1)
Unfortunately field (1) it's sys_id because it's reference from other table.
<u_type display_value="Responsibility">281c2a33875d8a50aacccaec0ebb357e</u_type>
<u_gime display_value="Senior Managers">6f2b6a77871d8a50aacccaec0ebb35bb</u_gime>
My Reference Qualifier looks like this:
Script Include like this:
gs.info('WWW REQ FULL START');
var uGime = 'u_gime';
var hr_RefQuaSMCRUtils = Class.create();
hr_RefQuaSMCRUtils.prototype = {
initialize: function(u_gime) {},
smcrObligationType: function() {
var ObligationTypeCheck = new GlideRecord('sn_hr_core_wwww_type');
ObligationTypeCheck.addQuery('u_gime',u_gime);
ObligationTypeCheck.query();
gs.info('WWW REQ how much: '+ObligationTypeCheck.getRowCount());
var obligationTypeListy = [];
while(ObligationTypeCheck.next()){
obligationTypeListy.push(ObligationTypeCheck.getUniqueValue());
}
gs.info('WWW ID: '+obligationTypeListy.toString());
return 'sys_idIN'+obligationTypeListy.toString();
},
type: 'hr_RefQuaSMCRUtils'
};
But I always got this error:
com.glide.script.RhinoEcmaError: "u_gime" is not defined.
sys_script_include.b69a2b9a97258e54e59cf5fce053af75.script : Line(2) column(0)
1: gs.info('WWW REQ FULL START');
==> 2: gs.info('WWW REQ u_gime: '+u_gime);
3: var uGime = 'u_gime';
4: var hr_RefQuaSMCRUtils = Class.create();
5: hr_RefQuaSMCRUtils.prototype = {
Generally I need to filter values in (2) based on what was choosed in field (1).
Any idea pls how to pass sys_id to scipt include and work with sys_id there ?
thx for info.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 02:15 AM
Hi @Don Dom
1. You are passing parameter to initialize function but you are calling function is smcrObligationType so you need to pass parameter here.
please try using below script:-
var hr_RefQuaSMCRUtils = Class.create();
hr_RefQuaSMCRUtils.prototype = {
initialize: function() {},
smcrObligationType: function(u_gime) {
var ObligationTypeCheck = new GlideRecord('sn_hr_core_wwww_type');
ObligationTypeCheck.addQuery('u_gime',u_gime);
ObligationTypeCheck.query();
gs.info('WWW REQ how much: '+ObligationTypeCheck.getRowCount());
var obligationTypeListy = [];
while(ObligationTypeCheck.next()){
obligationTypeListy.push(ObligationTypeCheck.getUniqueValue());
}
gs.info('WWW ID: '+obligationTypeListy.toString());
return 'sys_idIN'+obligationTypeListy.toString();
},
type: 'hr_RefQuaSMCRUtils'
};
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Ranjit

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 02:23 AM
Hi @Don Dom ,
Can you please try below script
gs.info('WWW REQ FULL START');
var uGime = 'u_gime';
var hr_RefQuaSMCRUtils = Class.create();
hr_RefQuaSMCRUtils.prototype = {
initialize: function(uGime) {},
smcrObligationType: function() {
var ObligationTypeCheck = new GlideRecord('sn_hr_core_wwww_type');
ObligationTypeCheck.addQuery('u_gime',uGime);
ObligationTypeCheck.query();
gs.info('WWW REQ how much: '+ObligationTypeCheck.getRowCount());
var obligationTypeListy = [];
while(ObligationTypeCheck.next()){
obligationTypeListy.push(ObligationTypeCheck.getUniqueValue());
}
gs.info('WWW ID: '+obligationTypeListy.toString());
return 'sys_idIN'+obligationTypeListy.toString();
},
type: 'hr_RefQuaSMCRUtils'
};
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 01:06 AM - edited 04-18-2024 01:09 AM
Hi @Don Dom ,
While passing the value to your script inlcude in your reference qualifier , can you pass value like this current.u_gime this will automatically pass sys_id.
Also could you please ecplain what is the significance of this statement
var uGime = 'u_gime';
I would suggest if you are storing value, try to store that which is not exactly the same name as your table column.
Please mark helpful/correct if my response helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 01:41 AM
I do not know to be honest. I got this error
com.glide.script.RhinoEcmaError: "u_gime" is not defined. sys_script_include.b69a2b9a97258e54e59cf5fce053af75.script : Line(2) column(0) 1: gs.info('WWW REQ FULL START'); ==> 2: gs.info('WWW REQ u_gime: '+u_gime); 3: var uGime = 'u_gime';
So I'm "lost" what is wrong in the Script Include 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 02:15 AM
Hi @Don Dom
1. You are passing parameter to initialize function but you are calling function is smcrObligationType so you need to pass parameter here.
please try using below script:-
var hr_RefQuaSMCRUtils = Class.create();
hr_RefQuaSMCRUtils.prototype = {
initialize: function() {},
smcrObligationType: function(u_gime) {
var ObligationTypeCheck = new GlideRecord('sn_hr_core_wwww_type');
ObligationTypeCheck.addQuery('u_gime',u_gime);
ObligationTypeCheck.query();
gs.info('WWW REQ how much: '+ObligationTypeCheck.getRowCount());
var obligationTypeListy = [];
while(ObligationTypeCheck.next()){
obligationTypeListy.push(ObligationTypeCheck.getUniqueValue());
}
gs.info('WWW ID: '+obligationTypeListy.toString());
return 'sys_idIN'+obligationTypeListy.toString();
},
type: 'hr_RefQuaSMCRUtils'
};
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Ranjit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 03:17 AM
thank you so much 🙂