Forums

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

copy insight object between fields using jira automation

Tobbe March 14, 2023

Hi

I have an Jira automation that creats a new issue in another project in 'Issue Create'

One of the fields to be copied is a insight field. The field exist in both project but different schemes wich means the key is different but name is the same. Using the default select fields to copy doesnt work becasue of that so Im trying to use more options -> JSON to copy the data.

Problem is that if I access the field value {{issue.customfield_24100}} I get "myvalue (XXX-1234)" The name and the key of the object. I cant use this data to set the field in the other project. 

I try to use {{issue.customfield_24100.substringBefore("(")}} to only get "myvalue" which should work fine but substringBefore() doesnt work on insight data it seems, only text fields.

I tried {{issue.customfield_24100.toString().substringBefore("(")}} and that doesnt work either.

Anyone knows how I can regex the Name attribute only from the isnight field without the object key?

 

1 answer

0 votes
Tobbe March 14, 2023

Ok I managed to get the name out with issue.customfield_24100.summary but the insight field wont take just the name it seems.

This is the JSON I use 

{
"fields": {
"Customfield_24100": "{{issue.customfield_24100.summary.asJsonStringArray}}",

}
}

 

Ive tried 

issue.customfield_24100

issue.customfield_24100.summary

issue.customfield_24100.summary.asJsonStringArray

issue.customfield_24100.summary.asJsonString

 

nothing of them can update the insight field

Malavika Vasudevan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 28, 2023

Hey @Tobbe

To confirm, you have an 2 schemes on your asset custom field, each scheme pointing to a different object schema for a different project? Example:

For Customfield_24100:

Scheme 1 -> Object Schema 1 -> Project 1

Scheme 2 -> Object Schema 2 -> Project 2

Tobbe March 29, 2023

correct, and the objects are the same. in this case countries. So I was thi8nking if I get the country name from one custom field I could copy the name to another. But it looksl ike asset custom fields nede an object and not only a name

Suggest an answer

Log in or Sign up to answer