Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Correct way to set Insight field value from Automation/REST

Sergei Gridnevskii
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.
September 5, 2022

JSON to update the field

 

I need to set a field a custom field in Jira issue. This field has Insight type and is a single selection. 

I tried to search community and Insight documentation but they are outdated and misleading, so this is what I found. In the end I will show you the way to find answers yourself.

 

Field: customfield_14472 
Issue: ADM-262
Object Key: AR-8155


As usual, add Edit Issue fields action, do not select field in Choose fields to select. 
Copy paste the following text into Additional fields section (under more options)


{
"fields": {
"customfield_14472": [{
"workspaceId": "e02eca9b-beba-4406-bcbc-6c95dcb24212",
"id": "e02eca9b-beba-4406-bcbc-6c95dcb24212:8155",
"objectId": "8155"
}]
}
}


What is workspaceId? It is your Insight database id. There is no easy way to find it, if you know it please tell me in comments. This is how I discovered it.


Discovering correct JSON format

 

1. Prepare a test ticket, say ADM-262

2. Find the field and set a known value to it. E.g. Customer Name

3. Go to your Insight database and find the customer. Recall the Key of the object, say AR-8155

4. Copypaste this url to you browser

https://<your company>.atlassian.net/rest/api/latest/issue/ADM-262

The page will show you large json with plenty of info. Press Ctrl+F and find your customer Key, in my case it is 8155.

"customfield_14472":[{"workspaceId":"e02eca9b-beba-4406-bcbc-6c95dcb24212","id":"e02eca9b-beba-4406-bcbc-6c95dcb24212:8155","objectId":"8155"}]



Now you can just copy this selected text into Automation and replace 8155 with whatever you receive from your rule.

This receipt works pretty much with every field type in Jira - setup it, create a test issue, set the field and receive internal representation through REST API. Then use it for automation.

I hope it helps!


1 comment

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events