- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 10:40 AM
Hey Everyone,
We have a script include that is being called in a variable list collector. In the reference qualifier section we have the following javascript: new dtbeLocation().NTIPJurisdiction(current.variables.u_state_name);
Our script include isn't client callable, but it works on the standard ui as an advanced reference qualifier for a glide_list field.javascript: new dtbeLocation().NTIPJurisdiction(current.u_state_name);
We are using the same field name as in the standard ui for u_state_name.
What are we doing wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 09:56 AM
Hey Everyone!
Yes, it has to be client callable to work. After changing the script include into a client callable, it worked. Thank you all for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 12:05 PM
I'm assuming on this record producer you have a variable named u_state_name that you are populating after the form loads? Is this mapped to a field or not? I'm not sure that it matters in this case. The List Collector is going to load when the form loads, so before the variable is populated. Add this to the Variable attributes so that the List Collector is updated when the state variable changes
ref_qual_elements=u_state_name
Then in the Script Include, if you haven't already done so, log the argument that u_state_name is getting passed into to determine if it is reaching the SI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 06:25 AM
This is what I have, but it still isn't working. The script include isn't client callable, but it still works in the standard ui. Not sure what I am doing wrong here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 06:53 AM
@Community Alums
for it to work from reference qualifier there is no dependency with client callable
can you share that script include script?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 08:00 AM
var dtbeLocation = Class.create();
dtbeLocation.prototype = {
initialize: function() {
},
NTIPJurisdiction : function(state) {
var sysIDs = [];
var gr = new GlideRecord("x_g_cfd_dtbe_help_location");
gr.addEncodedQuery("element=jurisdictions^application=NTIP Application^u_state_id="+state);
gr.query();
while(gr.next()) {
sysIDs.push(gr.getUniqueValue());
}
return "sys_idIN"+sysIDs.toString();
},
NTSSCountyAccess : function(state) {
var sysIDs = [];
var gr = new GlideRecord("x_g_cfd_dtbe_help_location");
gr.addEncodedQuery("element=counties^application=NTSS Application^u_state_id="+state);
gr.query();
while(gr.next()) {
sysIDs.push(gr.getUniqueValue());
}
return "sys_idIN"+sysIDs.toString();
},
TBGIMSCountyAccess : function(state) {
var sysIDs = [];
var gr = new GlideRecord("x_g_cfd_dtbe_help_location");
gr.addEncodedQuery("element=counties^application=TB-GIMS Application^u_state_id="+state);
gr.query();
while(gr.next()) {
sysIDs.push(gr.getUniqueValue());
}
return "sys_idIN"+sysIDs.toString();
},
LabNames : function(state) {
var sysIDs = [];
var gr = new GlideRecord("x_g_cfd_dtbe_help_location");
gr.addEncodedQuery("element=lab_names^application=TB-GIMS Application^u_state_id="+state);
gr.query();
while(gr.next()) {
sysIDs.push(gr.getUniqueValue());
}
return "sys_idIN"+sysIDs.toString();
},
NTSSCRCountyAccess : function(state) {
var sysIDs = [];
var gr = new GlideRecord("x_g_cfd_dtbe_help_location");
gr.addEncodedQuery("element=counties^application=NTSS-CR Application^u_state_id="+state);
gr.query();
while(gr.next()) {
sysIDs.push(gr.getUniqueValue());
}
return "sys_idIN"+sysIDs.toString();
},
type: 'dtbeLocation'
};