Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to check subtask's user

Saira
Contributor
November 21, 2022

Hello!

I'm trying to implement a validation check in a workflow that prevents the person who is transitioning a subtask to be the same person as the reporter of the parent issue.

So basically the current logged in user should not be the parent issue's reporter. I use Jira cloud and trying to use scriptrunner to do this

currentUser != issue.getParentObject().getReporter()

 

This is not working, what am I doing wrong? 

1 answer

0 votes
Hieu
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.
November 21, 2022

Hi @Saira maybe issue.getParentObject() can return null 
So issue.getParentObject().getReporter() can throw null pointer exception -> error

def parentTicket = issue.getParentObject()
parentTicket != null && (currentUser != parentTicket.getReporter())

or 

issue.isSubTask() && (currentUser != issue.getParentObject().getReporter())

Remember to publish your workflow before performing the test

Best regards,
Hieu

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events