Extract specific field value from Global Artifact Lookup Helper result array of Objects

I have created a Global Artifact, which is an Object with 4 String fields: Jira; Assignee; TeamsMessageID; Status. I want to extract a specific field into an Artifact, which I can then use as input to other steps later in the Workflow.

What I have working right now

I find the relevant Global Artifact entry; I use a Helper Look Up to query my Teams-Jira Global Artifact using exact match on the Jira field. This returns an array of Object (with 4 String attributes as above).

In this case, I’m only ever interested in the first element of the array; I don’t want to iterate multiple array elements but just select a String value from the first element of the array of matches.

Inside an Artifact, I can display the Helper output:
{{["Get Jira-Teams Map"].[matches]}}

gives me:

{
  "$success": true,
  "found": true,
  "matches": [
    {
      "Assignee": "Fakeperson Ticketworker",
      "Jira": "ITSEC-1234",
      "Status": "Pending",
      "TeamsMessageID": "1234567890"
    }
  ]
}

I can also select the first element in the array:
{{["Get Jira-Teams Map"].[matches].[0]}}
gives me:

{
  "Assignee": "Fakeperson Ticketworker",
  "Jira": "ITSEC-1234",
  "Status": "Pending",
  "TeamsMessageID": "1234567890",
  "__global_artifact_entry_id": {
    "entityId": "dc62023c-e0f9-4995-959f-2cc2c1c2d513",
    "globalArtifactId": "91cfb2ea-ea9a-453e-b181-f4f588ba8a0f"
  }
}

Where I’m stuck

I haven’t yet found the correct syntax to extract the TeamsMessageID value from the first element in the array. I’ve read Format Strings with Templates | InsightConnect Documentation and Input and Output Variables | InsightConnect Documentation among others.

I’ve tried:
{{["Get Jira-Teams Map"].[matches].[0].[TeamsMessageId]}}
and:
{{["Get Jira-Teams Map"].[matches].[0].["TeamsMessageId"]}}

Both of those result in a blank Artifact output. What I want is the value 1234567890 so I can subsequently use that as input to the Microsoft Teams plugin Send Message Action to reply to an existing conversation.

What am I doing wrong here?

It looks like the D is capitalized in the JSON but not in your examples you have tried, it looks like it should be {{[“Get Jira-Teams Map”].[matches].[0].[TeamsMessageID]}} try that and see if it works.

1 Like

Thank you @Michael-Cochran-Rapid7. That works nicely - glad you could spot my mistake! I’ll start by double-checking names next time.

Now I’ve got messages sent from Insight Connect replying to the relevant conversation in Teams, so each updates for a particular Jira ticket stays within a single Teams conversation. This gets me much closer to the overall functionality I’m aiming for with this workflow.

1 Like

Welcome, if you need anything else just ask.