The CreatorCon Call for Content is officially open! Get started here.

copy variables to task description

Bhavya11
Kilo Patron
Kilo Patron

hi ,

i have requirement for copy variables to task description.

i have workflow for that item

 

Kindly help.

 

Thanks,

BK

1 ACCEPTED SOLUTION

Bhavya11
Kilo Patron
Kilo Patron

I was able to achieve this using run script activity 

i have wrote below script in activity

var sctask = new GlideRecord("sc_task");
sctask.addQuery("request_item", current.sys_id);
sctask.query();
if (sctask.next()) {
gs.print(sctask.request_item);
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(sctask.request_item);
set.load();
var vs = set.getFlatQuestions();

workflow.scratchpad.description= '';

for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'false') {

workflow.scratchpad.description= workflow.scratchpad.description+ vs.get(i).getLabel() + " : " + vs.get(i).getDisplayValue() + "\n";

}

}
}

 then in catalog task activity  in advance script 

task.description=workflow.scratchpad.description;

View solution in original post

2 REPLIES 2

priyasunku
Kilo Sage

Hi @Bhavya11  in the workflow in catalog task activity

 

add can add it in the below script format.

 

task.description=current.variables.name1+' '+current.variables.name2;

 

 

 

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful

Bhavya11
Kilo Patron
Kilo Patron

I was able to achieve this using run script activity 

i have wrote below script in activity

var sctask = new GlideRecord("sc_task");
sctask.addQuery("request_item", current.sys_id);
sctask.query();
if (sctask.next()) {
gs.print(sctask.request_item);
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(sctask.request_item);
set.load();
var vs = set.getFlatQuestions();

workflow.scratchpad.description= '';

for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'false') {

workflow.scratchpad.description= workflow.scratchpad.description+ vs.get(i).getLabel() + " : " + vs.get(i).getDisplayValue() + "\n";

}

}
}

 then in catalog task activity  in advance script 

task.description=workflow.scratchpad.description;