- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 09:38 AM
I'm having problems getting a couple variables from an RITM copied into a change task.
I've built a workflow that creates a task after someone requests something. So the person that's responsible for working on the task doesn't have to go into the RITM, I simply just want to copy the variables of the RITM into the change task.
RITM Variables:
Want to copy these two lines into the change task
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 11:43 AM
Brad,
Try this
var var_list='';
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sys_id'));
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if((vs.get(i).getName()=='put in your variable Name here') || (vs.get(i).getName()=='put in your variable Name here')) {
var_list+=vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n";
}
}
task.description=var_list;
task.short_description=var_list;
This should work a expected now. Don't forget mark my responses as helpful and one of them as correct.
Thanks,
Abhinay
PS: Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 10:54 AM
Sorry for the confusion, I meant question. But, I see your question is too long. So I tweaked the code a little bit to use name instead of questions
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sys_id'));
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if((vs.get(i).getName()=='put in your variable Name here') || (vs.get(i).getName()=='put in your variable Name here')) {
task.description=vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n";
}
}
Thanks,
Abhinay
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 11:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 11:43 AM
Brad,
Try this
var var_list='';
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sys_id'));
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if((vs.get(i).getName()=='put in your variable Name here') || (vs.get(i).getName()=='put in your variable Name here')) {
var_list+=vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n";
}
}
task.description=var_list;
task.short_description=var_list;
This should work a expected now. Don't forget mark my responses as helpful and one of them as correct.
Thanks,
Abhinay
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2017 07:59 AM
I have a similar issue i am trying to get my variables to write to the TASK description field. I have tried your script in the Catalog task workflow item but nothing is writting. Please advise, here are the variables (questions) and the current script in place: (note I did not write the below script, I just need to add additional information for our new variables).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2017 09:08 AM
Did you use GlideappVariablePoolQuestionSet ?