It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Assignee is Always Null

Andrew Zibuda Oct 30, 2018

I am trying to write a script to update all child assignee's when an Epic or Story assignee is updated. The problem I am running into is I want to update assignee only when it is the same as what the old assignee was, or it is unassigned. However, when it is unassigned and I try to take displayName value of it to compare to old assignee, I get nullPointerException. So I tried to add

 if(issue.fields.assignee == null)

Before accessing displayName, but then none of the issues got through, even those WITH assignees on them. I then tried printing the issue.fields.assignee and it turns out even if there is an assignee and the sub-fields are populated it is still seen as null. Lastly, I tried to encompass it in a try-catch block, but then it throws the exception every time. If I only try to update fields that HAVE an assignee, it works without exceptions or anything. Below is the full code for the section...any advice would be great I have been stuck on this for some time.


if(issueSubTasks.size() > 0){" subtasks detected, updating fields on subtasks")

for(issueSubTask in issueSubTasks){
//Update each sub-task only if assignee was the same as the old or is empty
result = put('/rest/api/2/issue/'+issueSubTask.key)
.header('Content-Type', 'application/json')
assignee: issue.fields.assignee
.asString()"subtask updated: "+issueSubTask.key)

Again, as long as there are no "unassigned' issues going in to this, it works fine. This was the base code before running in to the issue with unassigned, where I tried all the above changes, with no success. 

1 answer

0 votes
Marc Minten (EVS) Oct 31, 2018

Did you try ... issue.assignee .... ? (without the ".fields." ?)

Andrew Zibuda Nov 01, 2018

issue.assignee does not exist

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

1,197 views 2 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you