Check if a string is in an array result

I need to check if the value of a string is in the result of an array. ([phoneNumbers][x][canonicalForm]). If you are, do nothing. If not, continue the flow.

In the example below, in the array there are these phoneNumber canonicalForms:
+5567999991234
+5567999994321
+5567999992222

If I search for +5567999991234, found it does nothing.
If I search for +5567999990000, not found, the flow continues.

Sounds simple, but I still can’t.

Thank you very much in advance

When pasting the flow, the fixed code I put in it didn’t come. See below:
[
{
“resourceName”: “people/c5709393818170352035”,
“etag”: “%EgcBAgsuNz0/GgECIgx3aisyTUF0SVowdz0=”,
“names”: [
{
“metadata”: {
“primary”: true,
“source”: {
“type”: “CONTACT”,
“id”: “4f3bd76d8edae1a3”
}
},
“displayName”: “TestName Surname1”,
“familyName”: “Surname1”,
“givenName”: “TestName”,
“displayNameLastFirst”: “Surname1, TestName”,
“unstructuredName”: “TestName Surname1”
}
],
“phoneNumbers”: [
{
“metadata”: {
“primary”: true,
“source”: {
“type”: “CONTACT”,
“id”: “4f3bd76d8edae1a3”
}
},
“value”: “67 99999-1234”,
“canonicalForm”: “+5567999991234”
}
],
“contactId”: “c5709393818170352035”
},
{
“resourceName”: “people/c1193592130726213033”,
“etag”: “%EgcBAgsuNz0/GgECIgxVY0t4dVRxUHdhaz0=”,
“names”: [
{
“metadata”: {
“primary”: true,
“source”: {
“type”: “CONTACT”,
“id”: “10907db80ea335a9”
}
},
“displayName”: “TestName Surname2”,
“familyName”: “Surname2”,
“givenName”: “TestName”,
“displayNameLastFirst”: “Surname2, TestName”,
“unstructuredName”: “TestName Surname2”
}
],
“phoneNumbers”: [
{
“metadata”: {
“primary”: true,
“source”: {
“type”: “CONTACT”,
“id”: “10907db80ea335a9”
}
},
“value”: “67 99999-4321”,
“canonicalForm”: “+5567999994321”
},
{
“metadata”: {
“source”: {
“type”: “CONTACT”,
“id”: “10907db80ea335a9”
}
},
“value”: “67 99999-2222”,
“canonicalForm”: “+5567999992222”
}
],
“contactId”: “c1193592130726213033”
}
]

Hey @sehcacsoF,
welcome to the community :tada:

You could try to join your phone numbers into a field phoneNumbersJoined using our Function Item node.

After that you can use our IF node testing if the string contains your phone number.

Here is an example workflow to illustrate

Thanks for the reply Marcus!

The result of the function is being “phoneNumbersJoined”: “+5567999994321 +5567999992222”

However, +5567999991234 from the previous node is missing.

image

The function returns two items.
How to return a single item with all canonicalForm values from the source?

I believe this would be a way, but I’m getting lost in something.

Hey @sehcacsoF,
in that case I would use two Item Lists nodes to split out phone numbers and than aggregate them into phoneNumbersJoined.

1 Like

Thank you so much for your help, Marcus.