1 comment

So I think the easiest way to accomplish this would be to use a ScriptRunner Fast-Track post-function.

All you would need to do is create the post-function on the "Scanning" stage of your workflow and then use a condition that checks all of the bugs that block the story and checks that their current stage is not equal to "Triage."

Try out something like this:

import com.atlassian.jira.component.ComponentAccessor

def linkManager = ComponentAccessor.issueLinkManager//Check that issue is of type Storyif(issue.issueType.name == "Story"){//Get all inward links that are bugsdef links = linkManager.getInwardLinks(issue.id).findAll{it.sourceObject.issueType.name == "Bug"} links.each{log.warn("Link: "+it.sourceObject.issueType.name)}for(def i=0; i<links.size(); i++) {def link = links[i]if(link.issueLinkType.name == "Blocks") {def blocker = link.sourceObjectlog.warn("Blocker: "+blocker.key)if(blocker.status.name in ["Triage"]) {//If the Bug is in one of those stages, do not transition the Storyreturn false } } }return true}else{//Do not do attempt fast-track if issue is not a Storyreturn false}

Then all you need to do is specify which Action to take in the case that the condition resolves to True. In this case, you choose the Scanned All Models transition.

Under which path we need to paste this script? We are tried this in Story workflow -->under all scanned mode transition--->script postfunction---> fast track--> added the script in Condition tab and selected Action(All Scanned mode).

But above method is not working.

Note: If Story(Sccaning) is blocked by 3 Bugs(Triage).

If we move all Bugs Triage to Inprogress then only the Story should move(do all scanned modes) Scanning to Inprogress

So for this case, you're going to need to add the fast-track to ALL of the transitions that lead to the Scanning stage. That way, any time a Story is transitioned to Scanning, it will run the check to fast-track or not fast-track the issue to In Progress.

Additionally, try moving the post-functions to the 3rd position in the execution order, above "Update change history for an Issue..."

So, now that I'm back on track, what you actually need to do is use a post-function on your "Reproduced" transition for your bugs (and maybe the Re-Open transition, but that's your choice).

Requirements:

Then you'll need a script that checks that the transitioned issue is a bug, that it is linked to a story, and that all of that story's blocking bugs are in the status "In Progress." If all of the story's bugs are "In Progress," transition the story to "In Progress" from "Scanning."

What do you mean when you say that it isn't working? Is it doing nothing? How are you testing it? What do you expect to happen? Give me a use-case that you've tested so that I can trace through the code to see the issue.

Additionally, could you give me a screenshot of the post-function's location in the execution order?

Good thing we checked the error message, or I would have been confused for a while. I had originally set this script up for a script listener and was using Event object to get the Issue object, which will definitely not work in a post-function.

So to fix this, all you should need to do is remove these two lines of code:

//Check that all bugs are in the status "In Progress" for(link in storyBugs) { if(link.issueLinkType.name == "Blocks") { def linkedBug = link.sourceObject //If one of the bugs is not "In Progress," then set canTransition to false and break from loop if(!(linkedBug.status.name in ["In Test"])) { canTransition = true break } } }

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...