Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,366,831
Community Members
 
Community Events
168
Community Groups

Need to show a transition screen for Sub-task based upon parent issue type

I'm looking to show a transition screen when a sub task is transitioned from x to y based upon parent issue type.

The requirements are :

  1. its should show/hide the fields on the screen based upon the parent issue type.
  2. its should set the fields required / optional on the screen based upon the parent issue type.
  3. the screen should show the parent issue type value.
  4. Looking for Behavior / script runner scripts.

 

 

1 answer

3 votes

You can't do this directly.  Behaviours can do the show/hide, and require/optional, but the choice of whether to show a screen is out of your control, as is the display of parent issue.

But you can do those indirectly:

  • Create a scripted field for "parent issue type" and use that on the screen
  • In the workflow, have two transitions
    • One with a screen, one without
    • Have a condition on both transitions that looks at the parent issue type and blocks the transition or allows it depending on type

Hi Nic,

Thanks for your reply.

We basically wanted to show the transition screen always for all sub-task transitions. We need to show fields in the transition screen based on the parent issue type. Thoughts ?

Ok, it's the same answer, but change "without a screen" to "with a different screen"

@Nic Brough _Adaptavist_ ,

I've used below code in behavior for all sub-task transitions.

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.*

def parentIssueType = getFieldById("Parent Issue Type")?.formValue
def fieldToHideA = getFieldByName("Target Release")
def fieldToRequireB = getFieldByName("Target Release")

if ( parentIssueType=="Bug Sub-task" && issueContext.issueType.name == "Sub-task" )
{

fieldToHideA.setHidden(true)

fieldToRequireB.setRequired(true)

}

 

the compiles without any error.

while the transition happening i'm not able to get the result as expected.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events