Category (Locked) field and Populating through automation
Asked by sheradyn.ford:

Hi All,

I'm trying to populate the recently introduced Issue Category field on Work Management Projects through an automation.

I have a cascading dropdown box configured that the users populate during issue creation. I was able to extract the level 1 value of that dropdown into a single line text field, however upon finding limitations in the filtering/grouping of the work management list view - am now trying to move the value from the single line text field to the Category field.

I've already added all the context options that could possibly be entered in that field through the automation, but I'm getting errors.

I've also tried populating the Issue Category field directly from the cascading dropdown, as well as from the Single Line text field I had originally configured.

It won't let me configure this through the simple method, so having to use advanced and I'm not very familiar with JSON coding.

Any help would be massively appreciated.

*** ** * ** ***

**Fields:
issue.customfield_10070** = Cascading Dropdown box providing value  
**customfield_10084** = Single Line text field originally configured to take the value from the cascading dropdown.  
**customfield_10080** = Issue Category (Locked) field trying to populate

*** ** * ** ***

**WORKING CODE**This is the code that is currently writing to the single line text field.

*{*   
*"fields": {*   
*"customfield_10084": "{{issue.customfield_10070.value}}"*   
*}*   
*}*

*** ** * ** ***

**NOT WORKING CODE**This is the code that is not working

*{*   
*"fields": {*   
*"customfield_10080": "{{issue.customfield_10084.value}}"*   
*}*   
*}*


Answers:
author: sheradyn.ford
body: Hi All,

So logged a support ticket and the assistance was super fast - same day! :O

And they've provided the correct JSON script to update the issue category value through automation.

So here it is:

{  
"update": {  
"customfield_10080": \[  
{  
"set": {  
"value": "{{triggerIssue.fields.customfield_10084}}"  
}  
}  
\]  
}  
}


author: John Funk
body: Hi Sheradyn,

Try this since Category can have multiple values.

{

"update": {

"customfield_10080": \[{

"add": "*{{issue.customfield_10084.value}}*"

}\]

}

}

comments: author: sheradyn.ford
body: Hi,

Thank you for your suggestion, unfortunately it didn't work.

**Attempt 1**

Error editing issues

TEAM-149 (Field with id' customfield_10080' and name 'Category' does not support operation 'add' Supported operation(s) are: 'set')

After trying to apply what the error suggested, tried again and got the next error.

**Attempt 2**

Error editing issues

TEAM-149 (Specify a valid 'id' or 'name' for Category (customfield_10080))

After doing some digging, I've tried getting more details using the rest API tools.

"customfield_10080":  
{"required":false,  
"schema":  
{"type":"option",  
"custom":"com.atlassian.jira.plugin.system.customfieldtypes:jwm-category",  
"customId":10080},  
"name":"Category",  
"key":"customfield_10080",  
"operations":  
\["set"\],  
"allowedValues":  
\[{"self":"https ://your-domain/rest/api/2/customFieldOption/10217",  
"value":"\[BM\] Bid Management",  
"id":"10217"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10218",  
"value":"\[BI\] Billing \& Invoicing",  
"id":"10218"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10219",  
"value":"\[CR\] Cost Recognition / GL",  
"id":"10219"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10220",  
"value":"\[NB\] Non-Billable Projects",  
"id":"10220"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10221",  
"value":"\[OB\] On/Offboarding",  
"id":"10221"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10222",  
"value":"\[OCS\] OCS",  
"id":"10222"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10223",  
"value":"\[OP\] Operations",  
"id":"10223"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10224",  
"value":"\[PA\] Project Activation",  
"id":"10224"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10225",  
"value":"\[PM\] Project Management",  
"id":"10225"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10226",  
"value":"\[RC\] Recons",  
"id":"10226"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10227",  
"value":"\[RM\] Resource Management",  
"id":"10227"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10228",  
"value":"\[RPT\] Reporting",  
"id":"10228"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10229",  
"value":"\[RR\] Revenue Recognition",  
"id":"10229"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10230",  
"value":"\[SO\] Security \& Organization",  
"id":"10230"},  
{"self":"https ://your-domain/rest/api/2/customFieldOption/10231",  
"value":"\[TE\] Time \& Expense",  
"id":"10231"}\]  
}


author: John Funk
body: I would open a support ticket with Atlassian - that field is new and everything might not be set up for it.

<https://support.atlassian.com/contact/#/>

Please post back here with the resolution.


author: John Funk
body: Well, I was close! It was the triggerissue instead of just issue.

Glad it is working for you!


author: sheradyn.ford
body: Yeah, thank you! :)

I had no idea how to phrase the query. :P


Tags: automation