Query scrum task table on create task in workflow editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 12:57 PM
Hello community,
I need your help with a bug in my script. The starts with a record producer which triggers a flow in flow designer first, which in turn calls a workflow. The script below is set in the context of a create task in that workflow. To be more precise, this is the second scrum task of the workflow. When the task is created, the script should query the scrum task table and copy the description of the first task into the description field of the second task.
This is what I have so far:
var gr = new GlideRecord("rm_scrum_task");
gr.query("parent.number", current.parent);
gr.orderBy("sys_created_on");
gr.query();
var array = [];
while(gr.next()){
array.push(gr.description.toString());
}
array[1] = array[0];
task_description = array[0];
The task is created but the description field is not populated. I think it is a bug in the second line of the script.
For further reference, I was able to make it work in script background by hardcoding a story:
var gr = new GlideRecord("rm_scrum_task");
gr.query("parent.number", "XXXXXXXXXXX");
gr.orderBy("sys_created_on");
gr.query();
var array = [];
while(gr.next()){
array.push(gr.description.toString());
}
array[1] = array[0];
task_description = array[0];
gs.print(task_description);
Any ideas?
Thanks in advance!