- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2018 07:51 AM
Hi,
I want to pass sys_id of a selected user in reference variable from catalog item to script include without using client side scripting like GlideAjax or getReference method? Kindly suggest.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2018 09:09 PM
Nevermind. I was able to get sys_id of user using following line of code instead of passing existing variable from one function to another.
var xyz = current.variables.<reference_variable_name>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2018 08:35 AM
Well, it depends on where/when you are using the script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2018 09:02 AM
Hi,
I have a variable (say x) in function A of a script include. This variable x has the value of sys_id of user.
I have another function B and I want to pass value of variable x from function A to function B.
I am able to do that but when I pass variable x to function B, along with sys_id value, it also passes an "undefined" value.
Could you help me figure out why it is passing an "undefined" value and how to get rid of it?
Here is the script include:
Script Include
Function A
==================================
A: function() {
//gs.info('sysid of user from catalog item reference variable '+ obj);
x = this.getParameter('sysparm_requested_for');
//Passing value of variable x to another function B
this.B(x);
}
B:function(x)
{
var y = x;
//gs.info(y) returns two values 1. sys_id of user and 2. undefined
.....
//follows to an outbound rest message which sends query parameter by using value of y
response.setQueryParameter('sysparm_query','user='+y);
}
So, here I want to get rid of 'undefined' value so that I can pass value of y as a query parameter. Could you please suggest?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2018 09:09 PM
Nevermind. I was able to get sys_id of user using following line of code instead of passing existing variable from one function to another.
var xyz = current.variables.<reference_variable_name>