Forums

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

Automation: copying value from object custom field

Paul Pasler _Seibert_
Community Champion
November 29, 2023

Hi there,

I'm struggling converting an object type custom field into another instance of the same field type.

Let me show the problem with a basic example (the real thing is a bit more complicated). 

I have Forge custom field type structured like this

{"keys": ["FOO-1","BAR-17"]}

Now I am trying to copy the value from "field1" to "field2", but instead of the structure shown above, I am getting this storage format 

{keys=[FOO-1,BAR-17]}

This is apparently no valid JSON and throws an error when copying the value to "field2"

 

This is my Example Automation rule

variable.pngedit-field.png

 

Any chance to convert this value to a valid JSON format?

1 answer

1 accepted

2 votes
Answer accepted
Bill Sheboy
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 Champions.
November 29, 2023

Hi @Paul Pasler _Seibert_ 

Please try using the function asJsonStringArray for that syntax:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/#asJsonStringArray

Kind regards,
Bill

Paul Pasler _Seibert_
Community Champion
November 30, 2023

Hi @Bill Sheboy ,

thanks for the hint, but unfortunately that doesn't work.

I don't get the right output format with the provided smart value functions (I also tried asJsonObject)

Cheers,

paul

Bill Sheboy
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 Champions.
November 30, 2023

What did you observe happening: an error or the update did not happen as expected?

 

Please show an image of how you tried to use that function.

From what you have shown, I would expect the syntax to be this substituting in your original field name and not the created variable:

{
"fields" : {
"keys" : {{issue.yourFieldName.asJsonStringArray}}
}
}
Like Paul Pasler _Seibert_ likes this
Paul Pasler _Seibert_
Community Champion
November 30, 2023

Hi @Bill Sheboy ,

it seems I wasn't smart enough :P 

It's working now as you suggested

 

I used it this way: 

"keys" : {{issue.field1.keys.asJsonStringArray}}

Thanks for your solution!

Like Bill Sheboy likes this
Bill Sheboy
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 Champions.
November 30, 2023

Awesome; I am glad to learn that helped!

Like Paul Pasler _Seibert_ likes this

Suggest an answer

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

Atlassian Community Events