Script Include isn't working on Variable for Record Producer

Community Alums
Not applicable

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? 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

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. 

View solution in original post

10 REPLIES 10

@Community Alums 

since it's list collector it will have multiple values so try using IN

I believe u_state_id is a reference field on the table x_g_cfd_dtbe_help_location

NTIPJurisdiction : function(state) {
var sysIDs = [];
var gr = new GlideRecord("x_g_cfd_dtbe_help_location");
gr.addEncodedQuery("element=jurisdictions^application=NTIP Application^u_state_idIN"+state);
gr.query();
while(gr.next()) {
sysIDs.push(gr.getUniqueValue());
}
return "sys_idIN"+sysIDs.toString();
},

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

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. 

@Community Alums 

both the places from where you are calling is server side so even if it's not client callable it should work fine.

Can you explain the solution?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

Hey Ankur, 

 

Yes, my architect explained that since it is a server-side script include we couldn't call it on the record producer. We had to use ajax which is automatically included in the script when we make it client callable. 

@Community Alums 

to call script include from a field or variable of catalog item it can be client callable or normal script include.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader