- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2017 08:58 AM
I have been looking at all the different post about pulling catalog item variable into the catalog task. Most of the post have been about pulling variables into the short.description. I would like to pull selected variable into the DESCRIPTION of the task.
My thoughts are to have a script within the Catalog item add all the variables that I wish to apply to the DESCRIPTION into one variable. Example var u_description = Var1 + Var2 + Var3 + ext.
Then in the Workflow apply task.description = current.variables.u_description.
With this ideology I can use one workflow, but in each catalog item I can define the variables I wish to apply to the task DESCRIPTION by adding them to u_description within the Cat Item.
Your thoughts please? And how do I apply this script to the Catalog Item?
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 12:59 PM
Can you try the below script. It is a onBefore Insert/Update business rule on Catalog task table
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.request_item);
set.load();
var vs = set.getFlatQuestions();
var description =''
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'false') {
description = description +vs.get(i).getLabel() + " : " + vs.get(i).getDisplayValue() + "\n";
}
}
current.description = description;
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 12:59 PM
Can you try the below script. It is a onBefore Insert/Update business rule on Catalog task table
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.request_item);
set.load();
var vs = set.getFlatQuestions();
var description =''
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'false') {
description = description +vs.get(i).getLabel() + " : " + vs.get(i).getDisplayValue() + "\n";
}
}
current.description = description;
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 03:07 PM
That worked.... You ROCK!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2017 09:42 AM
William,
What you intend is achievable.
But on catalog only client side code is done, still you can call server side code and make the description variable filled and finally in workflow you can populate the task description with description variable.
Instead of doing all that try a simpler way
In workflow populate task description will all the catalog Item variable you want.
task.description = current.variables.variable1+current.variables.variable2+ so on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2017 11:42 AM
Hi Kunal, I don't want to put that code in the workflow because we use the same workflow for most of our catalog items and different catalog items have different variables. So if I define u_description in the Catalog item, then for the workflow I just use task.description = current.variables.u_description and it will work for all catalog items.
Thank you for the suggestion, I had thought of that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2017 11:49 AM
Sounds cool. Discussion always target to right direction.