copy the description of a scrum task to another scrum task

santiago_bergal
Tera Expert

Hi! I'm working on a workflow where there is a story. The story has several scrum tasks and I need the description of the first scrum task to be copied with scripting to the description of the second scrum task. 

 

I'll be leaving a screenshot of the work flow and the code I have so far, which is not copying anything.

 

Thanks in advance!

 

var parent = current.sys_id;

task.parent = parent;


// Get the sys ID of the story
var storySysId = parent;

// Get the sys ID of the first and second tasks
var firstTask = new GlideRecord('rm_scrum_task');
firstTask.addQuery('story', storySysId);
firstTask.orderBy('sys_created_on');
firstTask.query();
if (firstTask.next()) {
var firstDescription = firstTask.description.toString();
}
var secondTask = new GlideRecord('rm_scrum_task');
secondTask.addQuery('story', storySysId);
secondTask.orderByDesc('sys_created_on');
secondTask.query();
if (secondTask.next()) {
secondTask.description = firstDescription;
secondTask.update();
}

6 REPLIES 6

Thanks @Ankur Bawiskar . No, I´m not sure. I'll double check. Thanks!

ritu_saluja
Tera Expert

write this in story table with below script-

var chgID = current.sys_id.toString();
var tasks = new GlideRecord('rm_scrum_task');
tasks.addQuery('story', chgID);
tasks.query();
while (tasks.next()) {
var taskID = tasks.sys_id.toString();
current.description = tasks.description;
tasks.update();

please mark my answer correct and helpful if it helps you