Hi everyone,
I'm trying to automate reassigning an issue in Jira as it moves through a couple levels of code review. When the issue moves from "To Do" to "In Progress", I'd like to automatically record the Assignee in a custom Author field.*
I've added Author, a custom person field, to the issue's template, but it's not appearing in the "Automation / Edit issue / Choose fields to set" dropdown. So I've been trying the advanced fields approach based on https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/
Currently I get the error "COM-48 (data was not an array (customfield_10051))" using this:
{"fields": {"Author": {"id": "{{assignee.accountId}}"}}}
or this:
{"fields": {"author": {{ assignee.accountId.asJsonObject("id")}}}}
The error occurs regardless of whether or not I restrict Author to a single person.
What should I be doing differently?
*Background:
An issue will progresses through two levels of review. When it goes to level 1 review, I'd like the assignee to become the level 1 reviewer. If the level 1 reviewer sends it back to the author for review resolutions, the assignee should become the author. When the level 1 reviewer sends it to level 2 review, the assignee will be the level 2 reviewer. It's possible for the level 2 reviewer to send it back to the author for additional work, which is why I can't use "assign to previous": that would take it back to the level 1 reviewer, not the author. Hence the need for an author field to make sure the assignee can reliably go back to the author.
hi @jtcours welcome on the community. I just tested your use case and I can add field to Edit Issue action. It also works nicely when adding Assignee value to Author(s) field. So I think the best approach is to find out why your field cannot be used for configuration.
I have two questions
My Edit Issue action configuration:
Hi @Martin Bayer _MoroSystems_ s_r_o__ , it's currently set as a team-managed project, but we're just learning Jira here, so it's possible something's misconfigured.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @jtcours thank you for detailed description. It really helps :). I have one more question. Do you need to append the assignee value to Author field or always just set/replace? If it is enough to replace it, you can use following advanced configuration. It is quite close to your first configuration:
{"fields": {"Author": [{"id": "{{assignee.accountId}}"}]}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the code, @Martin Bayer _MoroSystems_ s_r_o__ !
It's enough to replace it. I just need a way to get the assignee back to the original developer when transitioning out of review.
I was originally creating the field at the project level. I found that, if I create the field at the global level rather than in the project, it appears in the automation dropdown. So I can configure the automation through the GUI as long as it's a global custom field.
Unfortunately now, when I try this code in the automation, the GUI complains about an unknown field. I wonder if there's some difference between global and project-level custom fields, at least for Person fields, that's getting mixed up in all this troubleshooting.
The other interesting thing is that a global Author field doesn't appear in the list of fields I can display in the issue itself, unlike the project-level one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm going to mark this answer as the accepted one. I think between your approach and what I did, there's enough here to blaze a trail for the next person. Thank you very much for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @jtcours thank you, one last note... you cannot use "global" custom fields in team managed projects, the implementation of the fields and the configuration is different.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Martin Bayer _MoroSystems_ s_r_o__ Thank you so much for the config below.
{"fields": {"Author": [{"id": "{{assignee.accountId}}"}]}}
This is exactly what I've been trying to find for over 2 hours 🥹
In other threads, the solution is often presented as:
{ "fields": { "assignee": { "id": "{{initiator.accountId}}" } } }
Which would always give the error "data was not an array"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!
Register today
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.