Business rule for Stories
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 02:29 AM
I have a requirement to move future stories to current sprint. Could you please help me how to go about it using business Rule.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 02:04 AM
Hello @cracktech ,
*******This code is assuming you have only one active on going sprint***************
// Get the sys_id of the current active sprint
var grSprint = new GlideRecord('rm_sprint');
grSprint.addQuery('state', 'active'); // This condition you need to configure , how you define your current active sprint
grSprint.query();
if (grSprint.next()) {
var currentSprintSysId = grSprint.sys_id;
// Now let's move all future stories to the current active sprint
var grStory = new GlideRecord('rm_story');
grStory.addQuery('sprint', '!=', currentSprintSysId); // assuming 'sprint' is the field storing the linked sprint on a story record
while(grStory.next()){
grStory.sprint = currentSprintSysId;
grStory.update();
}
}
Hope this helps, It's worth running it, you can put setLimit and check whether it works.
Thanks,
Amarjeet Pal
Advania UK