Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,365,155
Community Members
 
Community Events
168
Community Groups

Correct way to set Insight field value from Automation/REST

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!


0 comments

Comment

Log in or Sign up to comment