Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,467,374
Community Members
 
Community Events
177
Community Groups

Condition to block/allow sub-task transition based on parent issue assignee

Newbie question:

I need some help to get the assignee of the parent issue type in a sub-task transition.

Scenario

  • A transition e.g. 'Cancel ticket' in a sub-task workflow is available only to the assignee of the parent ticket.
  • If the current assignee of the sub-task does not equal the assignee of the parent ticket, then the transition button should be hidden.

How can this be achieved in a sub-task transition using a scripted condition?

I tried the below:

issue.getAssignee() == return(parentIssue?.get("assignee")?.getName())

This gives me the below error:

The script could not be compiled:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script562.groovy: 1: unexpected token: return @ line 1, column 24.
   issue.getAssignee() == return(parentIssue?.get("assignee")?.getName())
                          ^

1 error

1 answer

1 accepted

1 vote
Answer accepted

Hi @Rahul Savaikar 

You can get parent using.

issue.getParentObject()?.getAssignee()

I hope it helps. Issue could be unassigned so add checked in your code.

Ravi

Hello @Ravi Sagar _Sparxsys_ 

Thank you as always. This worked pretty well.

We would not worry much about the ticket being unassigned, as the process is such, that the parent ticket is always assigned to a user 'X'.

Best Regards,

Rahul Savaikar

Hello @Ravi Sagar _Sparxsys_ 

Need some quick help - I tried adding the below as a Simple scripted condition to the sub-task workflow transition:

issue.issueType.name == 'Corrective action' && (issue.getAssignee() == issue.getParentObject()?.getAssignee())

However, the result is that, the transition is either shown to all (whether the assignee of the parent ticket or not) or not shown at all.

Even if I simply add a simple scripted condition as below, to the transition, it shows a similar behaviour as described above.

issue.getParentObject()?.getAssignee()

How can I compare the Sub-task Assignee and the Parent task Assignee in my case? Is my statement correct to compare both these attributes?

Regards,

Rahul Savaikar

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events