Filtering based on organization in a table on the order guide.

HenryD
Tera Guru

Hello currently I'm trying to filter based on organization in the order guide and using a variable as a reference field & created a script include to only show role records that match the organization. right now all the records are showing containing other organizations but i only want the ones to show that are from "Texas". any feedback is appreciated

 

 

 

TEXASUtil.prototype = {
initialize: function() {},

 

// UTIL script include 
getRole: function(Organization) {
var buildQuery = 'sys_idIN';

if (organization == 'Texas') {
var gr = new GlideRecord('u_states'); //u_states = states table
gr.addQuery('u_organization', Organization);
gr.addQuery('u_active', 'true');
gr.query();
while (gr.next()) {
buildQuery += "," + gr.sys_id.toString();

 

 

 

//reference qualifier i have in order guide variable that is referenced 

javascript: new TexasUtil().getRole(current.variables.organization)

2 REPLIES 2

Bert_c1
Kilo Patron

Hi HenryD,

 

It is hard to say without the complete function definition. What are you returning? If you post the complete function, folks here can then help.

Vishal Birajdar
Giga Sage

Hello @HenryD ,

 

You just need to put reference qualifier :

 

  • javascript:"u_organization="+ current.variables.organization;

I guess no need to write script include.

Hope this work....!!

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates