How can I update an issue's category via Automation?
Asked by Brock Jolet:

I've found a couple of similar posts, but they're not exactly what I'm looking for.

I am using Category in a JWM project because the "Group by:" options do not allow me to use Components or Labels or anything similar. However, I don't want to manually update every task and subtask when I assign a Category to an epic.

I want an automation rule that updates the children when the epic's Category is changed.

I am able to trigger a rule when the Category field changes. Then I perform a branch search for the following query:

```
parent in ({{triggerIssue.key}}) OR parentEpic in ({{triggerIssue.key}})
```

But I cannot figure out how to copy the value from the triggerIssue to these other issues; Category is not an option in the easy field picker and everything I try in the Additional Fields section throws an error.

To use the field in a filter, it's formatted as "Category\[Category\]", but using {{issue.Category.value}} appears to work as a smart filter.


Answers:
author: Mikael Sandberg
body: The category is a special custom field, and can only be set by using the More options and the advanced field editing. You need to find the ID for the category you want to set, one way of doing that is to have manual triggered automation that has a log action that you set to {{issue.Category}}.

This is what the JSON would look like to set the Category:

```
{
  "fields": {
    "Category": {
      "id": "<Category Id>"
    }
  }
}
```

comments: author: Mikael Sandberg
body: And if you are copying the category from the trigger issue the JSON would look like this:

```
{
  "fields": {
    "Category": {
      "id": "{{triggerissue.Category.id}}"
    }
  }
}
```


author: Brock Jolet
body: Thanks, [@Mikael Sandberg](/t5/user/viewprofilepage/user-id/853579) ! That worked perfectly!


author: Elizabeth Jones
body: I receive the following error: Additional fields contains invalid field(s) in 'update' or 'fields' section: Category


author: Daiane Noble
body: [@Mikael Sandberg](/t5/user/viewprofilepage/user-id/853579) Thank you a million times for the answer that actually worked. I found so many posts with other formats that didn't work and I was losing my mind. This is a lot simpler than having to find the custom field ID, and this page in the documentation does not even mention it: <https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/>

Do you know of any article that actually explains this is the right way to go about it?

Thank you!


author: Mikael Sandberg
body: [@Elizabeth Jones](/t5/user/viewprofilepage/user-id/4774578) This might be a bit late, but I missed your post, and just discovered that I also get the same error. It looks like now you have to use the custom field Id instead of the name, so the JSON should look something like this:

```
{
  "fields": {
    "customfield_xxxxx": {
      "id": "<Category Id>"
    }
  }
}
```


author: Trudy Claspill
body: Hello [@Brock Jolet](/t5/user/viewprofilepage/user-id/4412886)

When asking for help with an Automation Rule you have constructed it is very helpful if you post an image that shows all the steps in your rule.

In general if you are triggering a rule based on a change to a "parent", then the way to cycle through and update the "children" is to use the Branch option. You can use Branch For Related Issues Subtasks to update the direct subtasks of an issue. If the trigger issue is an Epic then you can use Branch For Related Issues Stories to update the child issues of the Epic.

![Screen Shot 2023-06-01 at 10.44.19 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/260804iDB666F3A3CFABC52/image-size/large?v=v2&px=999 "Screen Shot 2023-06-01 at 10.44.19 AM.png")

If the subtasks are under the child issues you will need to create two rules; one triggered by the change in the Epic and updating the child issues, and a second triggered by the change in the child issues and updating their subtasks, because Automation rules don't support nesting branches.

comments: author: Brock Jolet
body: Thanks, [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) . I ended up using the JQL from my post to avoid needing two rules. The suggestion from [@Mikael Sandberg](/t5/user/viewprofilepage/user-id/853579) helped me with the last bit that I needed.


Tags: automation

cloud

jira-work-management-cloud