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

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

Rahul Savaikar March 8, 2022

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

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Ravi Sagar _Sparxsys_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2022

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

Rahul Savaikar March 8, 2022

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

Rahul Savaikar March 9, 2022

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

TAGS
AUG Leaders

Atlassian Community Events