- 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 09:50 AM
Brad,
Assuming your workflow is on sc_req_item table and creating a task using create task workflow activity. Copy the following script into the create task workflow activity and this will copy the 2 variables into description field on the task
script:
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).getLabel()=='put in your variable label here') || (vs.get(i).getLabel()=='put in your variable label 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 10:34 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 10:36 AM
Brad,
I see that you have put in the variable names.(short_desc..) You need to put in the labels of your variable not the name.
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:47 AM