I've built a data action performing a contact lookup for ServiceNow. What I'd like to do is count the number records returned so I know if I had a single or multiple match.
My returned Data looks like this:
{
"records": [
{
"name": "personA"
},
{
"name": "personB"
},
{
"name": "personC"
}
]
}
My current work around is to look for a 2nd record and have a translationMapDefault value of "No" if there isn't one.
In my Architect flow I check if contact_two='No' then I know it was single match
{
"translationMap": {
"rawName": "$.records[0].name",
"rawContact_two": "$.records[1].name"
},
"translationMapDefaults": {
"rawContact_two": "\"No\""
},
"successTemplate": "{\n \"name\": ${rawName}\n, \"contact_two\": ${rawContact_two}\n }"
}
But I was hoping there was a more elegant way of achieving this by just counting the records and returning the count value
Thanks