To Copy All Variables information In catalog Task description

sri24
Giga Contributor

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

1 ACCEPTED SOLUTION

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";

 

}

 

}

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

 

View solution in original post

6 REPLIES 6

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";

 

}

 

}

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

 

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This might help:
2020-04-06 Generate Catalog Item Variables summary

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn