- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 09:04 AM
Hello all,
I'm trying to use a Variable from an Order Guide in a workflow but having difficulties. I have
current.variables.users_country does not work.
Any help would be great!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 11:17 AM
If you're on the request table, then you're going to need to query the RITM table for request items with the request of current. If all the items on the request will have that variable, then you can get the value from the first one (since it sounds like it will be identical across all items).
Something like the blurb below should grab that variable value while still running on the request table.
var user_country;
var gr=new GlideRecord('sc_req_item');
gr. addQuery('request', current);
gr.query();
if(gr.next()){
user_country=gr.variables.user_country;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 11:01 AM
I forgot to mention, the workflow is also running in the REQ not the RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 11:17 AM
If you're on the request table, then you're going to need to query the RITM table for request items with the request of current. If all the items on the request will have that variable, then you can get the value from the first one (since it sounds like it will be identical across all items).
Something like the blurb below should grab that variable value while still running on the request table.
var user_country;
var gr=new GlideRecord('sc_req_item');
gr. addQuery('request', current);
gr.query();
if(gr.next()){
user_country=gr.variables.user_country;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 11:55 AM
Dan/Ban thanks a bunch for the help!
This finally worked using:
workflow.scratchpad.country = '';
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.sys_id);
gr.query();
if(gr.next()){
workflow.scratchpad.country = gr.variables.users_country;
}