Current.variables.<variable name> not working in my catalog item's workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2017 01:32 PM
My workflow has an "Approval User" activity with a script that uses a Gliderecord to filter a table
Here is my code:
var target = new GlideRecord ('u_application_table);
target.addQuery('name', current.variables.what_app_name);
target.addQuery('u_permissions', current.variables.what_permissions);
target.query();
I'm trying to use current.variables.<variable name> in lines 2 and 3 to pull the values of the variables what_app_name and what_permissions. If I replace them with a string like 'hello' I do get results but doing it the way I do above gets me nothing. Am I doing something wrong? These variables are lookup select boxes that reference two columns in my application_table table. I'm wondering if the fact that they are references is whats messing something up.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 09:33 AM
current.variables.VARIABLENAME.getDisplayValue()
try with above script and you can put log there and check what's exactly it's coming in that variable.
var check= current.variables.VARIABLENAME.getDisplayValue();
gs.log('Testing the Value :'+check);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 10:53 AM
Hey Harsh,
So I ran your test using:
1) var check= current.variables.VARIABLENAME.getDisplayValue();
2) var check= current.variables.VARIABLENAME.;
and once again using a different variable that isn't a reference filed but a text box and for all 3 attempts I got the value "undefined".
No clue what I'm doing wrong here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 11:23 AM
When runnning current.sys_id I'm getting the sys_id for the Request number record on the sys_request table. Variables don't appear to be accesible from that record. I have to click into the Request Item related list in the Request number record to see the variables which is why I think running current.variables isn't the right thing to do here. I'm just trying to think through this. I'm also using Jakarta if that makes a difference. I don't know if anything was changed between releases.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 11:42 AM
would you try to make that variable as global and then try to check in workflow script with log . if it's coming or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 11:58 AM
Just ran this script in my workflow using a previous RITM # and got the value from my variable. So that works but I need to do it using current.variables.<myvariablename> or something similar. The way I did it just below was by manually entering a RITM #
var gr = new GlideRecord('sc_req_item');
gr.addQuery('number','<MY RITM #>')
gr.query();
while(gr.next()){
gs.log('This is a test for value : ' + gr.variables.<MY VARIABLE NAME>);
}