Copy value between 2 Insight Custom fields with Automation for Jira

Marco Brundel
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.
November 16, 2018

Our customer uses Jira Service Desk, Insight and Automation for Jira.

When creating an issue, I want to automatically copy the value of an Insight Custom Field to another Insight Custom Field. Field 1 is a sub-set of field 2.

At EDIT in Automation for Jira I can not choose the Insight Custom fields.

Is is possible with JSON in additional fields to copy the value?

2 answers

2 accepted

1 vote
Answer accepted
Deleted user November 19, 2018

Hey there Marco,

Is is possible with JSON in additional fields to copy the value?

Yep you should be able to do this as per the spec at: https://documentation.riada.io/display/ICV50/Insight+with+JIRA+REST-API

I'm not 100% sure what the format of the field that comes out of Insight looks like, but you can see this for yourself by opening up the REST URL for your issue:

http://myjiraurl.com/rest/api/2/issue/ISSUEKEY-1

You should be able to find the Insights field for your issue, if you can send this through & point to the custom field ID of your Insights field, we can help you out more specifically.

 I suspect your JSON may look like:

{    "fields" : {        "customfield_10200" :  {{issue.customfield_10200.asJsonObjectArray("key"}})   }}

Let us know if that helps. If you can't add screenshots here for privacy reasons, feel free to ping us at https://codebarrel.atlassian.net/servicedesk/customer/portal/1

Cheers,

Mark C

Steve Letch August 12, 2019

Hi Mark

 

the format in the API for mine is

 

  • customfield_12045: [
    • "Desktop (SC-182)"
    ],

 

However my json is invalid

 

{
"update": {
customfield_12045: [ "Service Desk (SC-5604)" ],
}
}

1 vote
Answer accepted
Yinon Negev
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.
November 19, 2018

Hi Marco.

      It seems like your Request may be done using an Insight Postfunction, such as Change Insight Value into Insight Object .

Make sure that when using custom fields that the custom field value is possible to set to the target attribute. If not it will be discarded.

Additionally, note that if you use any Insight post function on the create transition should be placed after the actual creation of the issue. So do not put it first in the list, it will not work.

Another possible way to achieve your requirement is by setting up the "Filter Assign Scope" on the Second customfield, to reference the Object selected in the First CF (using Placeholder) when automatically Assigning a Value, using an IQL like "object HAVING inR(anyAttribute=${MyFirstCFName})" - this IQL can be refined to suite your use case.

Kind regards,

Yinon

Team Riada

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events