How to set issue category in automation
Asked by Klaus Ergert:

I setup an automation which is recurring each month and has a new issue as action.

![Screenshot 2023-02-13 120010.png](https://community.atlassian.com/t5/image/serverpage/image-id/239830iC7E4807C0D05940A/image-size/large?v=v2&px=999 "Screenshot 2023-02-13 120010.png")

Everything works fine but I also want to set the issue category to an already existing value.

The field itself is not available in the automation UI, there is this question where the field is referred to with **{{issue.Category.value}}**

<https://community.atlassian.com/t5/Jira-Service-Management/Automation-rule-for-Issue-Category-field/qaq-p/2105656>

---

When doing an JQL Query it is referred to as **"Category\[Category\]"**

I also tried with JSON but no success - can someone please help with this?


Answers:
author: Mark Higgins
body: Hello all,

Appreciate this is a long running question, but I have just managed to solve this for myself.

I used the customfield id.

<br />

"fields": {  
"customField_10160": { "value": "{{Object."Control Category".Name}}" }  
}  
}

So this is a JWM project, and the field Category\[Category\] is customfield_10160.

The value I am assigning comes from ASSETS, and so it needs to go btw quotes.

![11Screenshot 2024-04-16 170610.png](https://community.atlassian.com/t5/image/serverpage/image-id/318516iF3287012E5A53E9B/image-size/large?v=v2&px=999 "11Screenshot 2024-04-16 170610.png")

THe audit log shows:![alogScreenshot 2024-04-16 170828.png](https://community.atlassian.com/t5/image/serverpage/image-id/318517iE49DE21D382BF01A/image-size/large?v=v2&px=999 "alogScreenshot 2024-04-16 170828.png")

And then in the ticket we have:

![aaaScreenshot 2024-04-16 170946.png](https://community.atlassian.com/t5/image/serverpage/image-id/318519iD65E3C3085B9985E/image-size/large?v=v2&px=999 "aaaScreenshot 2024-04-16 170946.png")

which then displays on the list as:

![1aScreenshot 2024-04-16 171121.png](https://community.atlassian.com/t5/image/serverpage/image-id/318521i65E5344CE008C21A/image-size/large?v=v2&px=999 "1aScreenshot 2024-04-16 171121.png")


author: Trudy Claspill
body: Hello [@Klaus Ergert](/t5/user/viewprofilepage/user-id/4122040)

This is the JSON that you need. Replace **category1** with a valid Category value for your project.

```
{
  "fields": {
    "Category": { "value": "category1" }
  }
}
```

comments: author: Elizabeth Jones
body: I have the same challenge but received the following error: Additional fields contains invalid field(s) in 'update' or 'fields' section: Category


author: Trudy Claspill
body: Hello [@Elizabeth Jones](/t5/user/viewprofilepage/user-id/4774578)

Can you check your environment to see if you have more than one custom field named Category defined for the system?

Are you running the automation rule for a Team Managed project or a Company Managed project?

Can you show us the automation rule, the details of the Edit action, and the output in the rule audit log?


author: Nh?t ??ng L?
body: Hello [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) , thanks so much for your solution, I was trying to automatically assign a category based on keywords in the summary field, and stumbled on your answer. Within the "Edit issue fields" action, I can't find the Category field to simply add a value, and your JSON worked beautifully. I just need to select "Environment" as the field, set the option to "SET" and then use your JSON. Sharing for anyone else in need.  
![Screenshot 2024-01-06 164937.png](https://community.atlassian.com/t5/image/serverpage/image-id/299192i83C7AB576F5CA6C2/image-size/large?v=v2&px=999 "Screenshot 2024-01-06 164937.png")


author: Eduardo Lello
body: Hi [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) I am having the same issue as [@Elizabeth Jones](/t5/user/viewprofilepage/user-id/4774578) - I set the rule as above and got the same error. I have this category created and I can select it manually in the list view or on a ticket. Not sure what's wrong. Thank you in advance!

![Untitled 5.png](https://community.atlassian.com/t5/image/serverpage/image-id/307286i57F5C4AF249FA270/image-size/large?v=v2&px=999 "Untitled 5.png")


author: Eduardo Lello
body: I also tried using changing 'fields' to 'field' in the Additional fields text box's code above which seemed to fixed the error but now on the audit log it says some errors. attaching the error log here... Not sure what it's wrong. Attaching here some more screenshots:

![Untitled 7.png](https://community.atlassian.com/t5/image/serverpage/image-id/307290i577ECA23C3ECC0D8/image-size/large?v=v2&px=999 "Untitled 7.png")![Untitled 6.png](https://community.atlassian.com/t5/image/serverpage/image-id/307291i664E51ED375F8338/image-size/large?v=v2&px=999 "Untitled 6.png")

Thank you!


author: Trudy Claspill
body: Hello [@Eduardo Lello](/t5/user/viewprofilepage/user-id/5433132)

It should be "fields", not "field".

Can you check your environment to see if you have more than one custom field named Category defined for the system? You can determine this by going to the **View all issues** page under the **Filters** menu, then enter a JQL statement. Start typing in **category** and Jira will show you all the fields that have that as part of their name. Check if more than one field is being suggested with the name just **Category**.

Are you running the automation rule for a Team Managed project or a Company Managed project?