Keep value inside many collections

Hello,

I’m retrieving events in CRM Kommo and need to insert the data into Facebook API conversion.

The Json return from my CRM is this:

[
{
“id”: 20732675,
“name”: “Marcelo Zanatto”,
“first_name”: “Marcelo”,
“last_name”: “Zanatto”,
“responsible_user_id”: 8988539,
“group_id”: 0,
“created_by”: 0,
“updated_by”: 0,
“created_at”: “2024-03-28T13:33:17.000Z”,
“updated_at”: “2024-03-28T13:33:17.000Z”,
“closest_task_at”: null,
“is_deleted”: false,
“is_unsorted”: false,
“custom_fields_values”: [
{
“field_id”: 181994,
“field_name”: “Phone”,
“field_code”: “PHONE”,
“field_type”: “multitext”,
“values”: [
{
“value”: “+5511999504573”,
“enum_id”: 124322,
“enum_code”: “WORK”
}
]
},
{
“field_id”: 495412,
“field_name”: “User terms”,
“field_code”: “USER_AGREEMENT”,
“field_type”: “checkbox”,
“values”: [
{
“value”: true
}
]
}
],
“account_id”: 30759399,
“_links”: {
“self”: {
“href”: “https://eufacoseumarketing.kommo.com/api/v4/contacts/20732675?with=catalog_elements%2Cleads%2Ccustomers&page=1&limit=250
}
},
“_embedded”: {
“tags”: ,
“leads”: [
{
“id”: 17425151,
“_links”: {
“self”: {
“href”: “https://eufacoseumarketing.kommo.com/api/v4/leads/17425151?with=catalog_elements%2Cleads%2Ccustomers&page=1&limit=250
}
}
}
],
“customers”: ,
“catalog_elements”: ,
“companies”:
}
}
]

And I’m having difficulty getting the E-Mail, Telephone within the collection called “custom_fields_values” due to the fact that it has 2 levels.

My intention is to take these values ​​and create 2 variables.

I tried every way to use the map and get functions, but without success.

Can you help me?

Thanks
Zanatto

Solved:

{{get(get(map(5.custom_fields_values; “values”; “field_code”; “PHONE”); 1); “1.value”)}}

{{get(get(map(5.custom_fields_values; “values”; “field_code”; “EMAIL”); 1); “1.value”)}}

2 Likes

Excellent solution! Good job figuring this out and for sharing it with us.

Links

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

2 Likes