Pass variable to script include from reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 08:41 AM
I have an advanced reference qualifier calling a script include and passing it current.
javascript:new global.COMP_UserHelpers().showInactive(current);
I am needing to pass a different variable to the script include. Is it possible to define and pass this variable in the reference qualifier? I tried the following two permutations in attempt to pass the variable tmpShowInactive with no luck. Any thoughts?
javascript:new global.COMP_UserHelpers().showInactive(var tmpShowInactive = {u_show_termed_users : true});
javascript:var tmpShowInactive = {u_show_termed_users : true} new global.COMP_UserHelpers().showInactive(tmpShowInactive);
TIA for assistance.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 09:13 AM
Why do you wanna do that...is u_show_termed_users a field on the current form? if yes then you can simply pass..current.u_show_termed_users to send the value of current.u_show_termed_users. Please clarify.
javascript:new global.COMP_UserHelpers().showInactive(current.u_show_termed_users)
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 09:18 AM
If this is in a reference qualifier, you do not need to pass any parameters. Script include will automatically have access to current object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 09:23 AM
So current object is now a new form. When the original form was created, it does have a field named u_show_termed_users. However, I am looking to call this from a different form that does not contain the u_show_termed_users field. I was thinking that I could pass a temp variable in place of 'current' and set the u_show_termed_users field to 'true'. Maybe there is a better way to do this? I was just trying to avoid creating another script include or adding the u_show_termed_users field on this new form. The original form will still call this script include as well.
The script include is here:
var COMP_UserHelpers = Class.create();
COMP_UserHelpers.prototype = {
initialize : function() {
},
showInactive : function(gr){
//Check to see if current.u_show_termed_users is true or false, if FALSE return only active users (through filter)
if (!gr.u_show_termed_users) {
return 'active=true';
}
return ''; // send empty string (not null)
},
type: 'COMP_UserHelpers'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 09:26 AM
You can use glideRecord API to access that table and then set the field in the same script include..refer below link :
http://wiki.servicenow.com/index.php?title=GlideRecord#gsc.tab=0