How to send Insight custom field data

Custom Field: Object(s)

Custom field ID: 12345


Send the complete array of objects

To access the insight custom field make a mustache with this syntax 

{{issue.customfield_12345}}

That will resolve on the issue to 

[MY OBJECT1 (KEY-1), MY Object 2(KEY-2)]

Send the first object as string

{{issue.customfield_12345.first}}

That will resolve on the issue to 

MY OBJECT1 (KEY-1)

Send the first object KEY as string

{{issue.customfield_12345.first.objectKey}}

That will resolve on the issue to 

KEY-1

Send the first object Name as string

{{issue.customfield_12345.first.name}}

That will resolve on the issue to 

MY OBJECT1

Send the first object ID 

{{issue.customfield_12345.first.id}}

That will resolve on the issue to 

52188

Send the first object attributes

The attributes are a bit more tricky since they are not stored on the custom field it self. To access them wee need to do a parent → child action.

The parent will do send GET on /rest/insight/1.0/object/{id}

The response will the contain the attributes we are interested in, these will be passed down to the child and send to the external endpoint.


Parent

GET on /rest/insight/1.0/object/{{issue.customfield_12345.first.id}}

Result

 


Child

To access specific attribute use JSON Path and assign to a variable.

Lets say that we want attribute id 2455 then use this JSON path 

MyAttribute = $.attributes[?(@.id==2455)].objectAttributeValues[0].value


{{MyAttribute}}

That will resolve on the issue to 

THE ATTRIBUTE VALUE

Using the attribute type id then this expression is better to use, it does to the node and pick the json for that part.

$..[?(@.objectTypeAttributeId==685)].objectAttributeValues[0].value 


Get attribute value for an object

Make a GET request to a single object GET on /rest/insight/1.0/object/{{issue.customfield_12345.first.id}}

Then assign a variable on the child to the attribute value

$.objectEntries.[0].attributes[?(@.objectTypeAttributeId==41076)].objectAttributeValues[0].value