The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Business rule for Stories

cracktech
Kilo Contributor

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

Amarjeet Pal
Kilo Sage
Kilo Sage

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