- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 12:10 AM
Hello All,
After user submits the Request, I need to copy all the variables information into Description field of Catalog Task. How can i do this can anyone please help me with this.
Thanks in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 05:33 AM
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";
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 04:45 AM
Hi,
Write a Business Rule on the 'sc_req_item' table.
Condition: item>> Your catalog item name
Now paste the below code in the advanced script:
var variables = current.variables.getElements();
var str = '';
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion();
var variableLabel = question.getLabel();
var variableValue = question.getDisplayValue();
str = str + variableLabel + ' - ' + variableValue + '\n';
}
current.short_description = str;
Please mark correct answer if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 05:19 AM
Hello Ankur,
I need to update catalog task description i tried with your script but no luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 04:58 AM
Hello,
var grVariableRelation = new GlideRecord('sc_item_option_mtom');
grVariableRelation.addQuery('request_item', current.getUniqueValue());
grVariableRelation.addNotNullQuery('sc_item_option.value');
grVariableRelation.orderBy('sc_item_option.order');
grVariableRelation._query();
while(grVariableRelation._next()) {
descriptionStr += grVariableRelation.sc_item_option.item_option_new.getDisplayValue() + ': ' + current.variables[grVariableRelation.sc_item_option.item_option_new.name].getDisplayValue() + '\n';
}
task.description = descriptionStr;
Hope this helps. Please mark the answer as correct/helpful based on impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 05:18 AM
Hello Saurav
it's not working
Hope this helps. Please mark the answer as correct/helpful based on impact.