Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to automate copying an issue field value into a custom field?

Martin Beke January 28, 2022

Hello Atlassian Community,


When the issue is updated I try to copy the value of the custom field of type the name 'Entity and site' to another custom field 'Entity'. 

I created an automation rule for that process.

Because I want to use this field for the Pie Chard gadget both custom fields are Select List (cascading) type.

How I can copy a specific value from the custom field 'Entity and site' to the custom field 'Entity' to be set using a JSON object?

{
"fields": {
      "customfield_13429": "{{customfield_10205.Entity and site.value}}"
    }
}

unfortunately, these records get an error

SUPPORT-6955 (Can not instantiate value of type [simple type, class com.atlassian.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean] from JSON String; no single-String constructor/factory method (customfield_13429))

automation.jpg

Any help would be appreciated!

2 answers

1 accepted

1 vote
Answer accepted
Support Team [Clearvision]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2022

Hi Martin

Sounds like you have one cascading select list and you want to copy the value and child value to another cascading custom field

If that is the case you can try something like

{
"update": {
"select list 2 (cascading)": [
{
"set": {
"value": "{{select list cascading.value}}",
"child": {
"value": "{{select list cascading.child.value}}"
}
}
}
]
}
}

where select list 2 (cascading) is the same of the field to be updated from select list cascading

Martin Beke January 31, 2022

Hi @Support Team [Clearvision] thank you for your quick response, yes, I have two custom fields of type cascading select list 'Entity and site' and 'Entity'.  Both custom fields are a lot of values and child values, I want to copy the only entity value from this custom field 'Entity and site'

example
When I select one of that values on an issue 'entity 1' from the custom field 'Entity and site' then copy entity value: 'entity 1' to the custom field 'Entity'.

I want to copy only the entity value without child value.

Thank you for any appearance.

Support Team [Clearvision]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 1, 2022

Hi Martin

Thanks so if you only want the parent value you can use the same as above and remove the child key and value and just set the value

note the two lists will need to have the same values available

Martin Beke February 1, 2022

Hi @Support Team [Clearvision] thank you! automation rule has been successfully set up and works as expected

note: that JSON working with custom fields of type select list (cascading) and (single choice) as well

Like Deleted user likes this
0 votes
Ravi Sagar _Sparxsys_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2022

Hi @Martin Beke 

You can always get the issue's JSON data and check how data is stored using this end point.

/rest/api/3/issue/abc-123

In your rule what are the field types?

Also take a look at the smart value documentation to learn how to fetch values.

Ravi

Martin Beke February 1, 2022

update: the automation rule has been successfully configured on the previous comment

Hi @Ravi Sagar _Sparxsys_
thank you, in my rule are custom fields of type cascading select list. Both custom fields are a lot of values and child values, I want to copy the only entity value from this custom field 'Entity and site'

"customfield_10600": null,
"customfield_10205": {
"self": "https://mycompany.atlassian.net/rest/api/3/customFieldOption/10112",
"value": "LIB",
"id": "10112"
},

to this custom field 'Entity', where that value will be dynamic based on selection.

"customfield_10200": null,
"customfield_13427": null,
"customfield_11801": null,
"customfield_13429": {
"self": "https://mycompany.atlassian.net/rest/api/3/customFieldOption/13218",
"value": "LIB",
"id": "13218"
},

When I select Entity value from the 'Entity and site' custom field I expect to copy that entity value to the 'Entity' custom field.

Thank you for any ideas

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events