How do I store this value in a variable?

Hi guys, I’m aware that i need to use a combination of get and map here. But I’m still struggling to understand how I can achieve this in this specific case:

I’d like to store the value within the collection inside the values array.

Welcome to the Make community!

If you need further assistance, please provide the following:

Please provide the output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.
Uploading them here will look like this:

module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

This will allow others to better assist you. Thanks!

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

hello! here is the output:

[
    {
        "id": 7369068,
        "name": "josé",
        "first_name": "",
        "last_name": "",
        "responsible_user_id": 11555991,
        "group_id": 0,
        "created_by": 11555991,
        "updated_by": 11555991,
        "created_at": "2024-07-17T15:24:18.000Z",
        "updated_at": "2024-07-17T15:24:18.000Z",
        "closest_task_at": null,
        "is_deleted": false,
        "is_unsorted": false,
        "custom_fields_values": [
            {
                "field_id": 596696,
                "field_name": "Phone",
                "field_code": "PHONE",
                "field_type": "multitext",
                "values": [
                    {
                        "value": "+5571999999965",
                        "enum_id": 424606,
                        "enum_code": "WORK"
                    }
                ]
            }
        ],
        "account_id": 33136427,
        "_links": {
            "self": {
                "href": "https://advogadowave.kommo.com/api/v4/contacts/7369068?with=&limit=250&filter%5Bid%5D=7369068&page=1"
            }
        },
        "_embedded": {
            "tags": [],
            "companies": []
        },
        "__IMTLENGTH__": 1,
        "__IMTINDEX__": 1
    }
]

Thanks for reaching out to the community.

Please apply below formula to solve your issue.

{{1.custom_fields_values[].values[].value}}

Regards,
Msquare Automation - Gold Partner of Make

Book a Free Consultation | Connect Live

Explore our YouTube Channel for valuable insights and updates!

You can use the built-in function map and first.

e.g.:

{{ first(map(1.custom_fields_values; "values.1.value"; "field_name"; "Phone")) }}

Output

Screenshot_20240719_162927

For more information, see the function documentation in the Help Center.

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

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

4 Likes

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

Click to Expand Module Export Code

JSON - Copy and Paste this directly in the scenario editor

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 166,
                    "module": "json:ParseJSON",
                    "version": 1,
                    "parameters": {
                        "type": ""
                    },
                    "mapper": {
                        "json": "[\n    {\n        \"id\": 7369068,\n        \"name\": \"josé\",\n        \"first_name\": \"\",\n        \"last_name\": \"\",\n        \"responsible_user_id\": 11555991,\n        \"group_id\": 0,\n        \"created_by\": 11555991,\n        \"updated_by\": 11555991,\n        \"created_at\": \"2024-07-17T15:24:18.000Z\",\n        \"updated_at\": \"2024-07-17T15:24:18.000Z\",\n        \"closest_task_at\": null,\n        \"is_deleted\": false,\n        \"is_unsorted\": false,\n        \"custom_fields_values\": [\n            {\n                \"field_id\": 596696,\n                \"field_name\": \"Phone\",\n                \"field_code\": \"PHONE\",\n                \"field_type\": \"multitext\",\n                \"values\": [\n                    {\n                        \"value\": \"+5571999999965\",\n                        \"enum_id\": 424606,\n                        \"enum_code\": \"WORK\"\n                    }\n                ]\n            }\n        ],\n        \"account_id\": 33136427,\n        \"_links\": {\n            \"self\": {\n                \"href\": \"https://advogadowave.kommo.com/api/v4/contacts/7369068?with=&limit=250&filter%5Bid%5D=7369068&page=1\"\n            }\n        },\n        \"_embedded\": {\n            \"tags\": [],\n            \"companies\": []\n        },\n        \"__IMTLENGTH__\": 1,\n        \"__IMTINDEX__\": 1\n    }\n]"
                    },
                    "metadata": {
                        "designer": {
                            "x": 2464,
                            "y": -1511
                        },
                        "restore": {
                            "parameters": {
                                "type": {
                                    "label": "Choose a data structure"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "type",
                                "type": "udt",
                                "label": "Data structure"
                            }
                        ],
                        "expect": [
                            {
                                "name": "json",
                                "type": "text",
                                "label": "JSON string",
                                "required": true
                            }
                        ]
                    }
                },
                {
                    "id": 167,
                    "module": "util:SetVariable2",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "name": "myVariable",
                        "scope": "roundtrip",
                        "value": "{{first(map(166.custom_fields_values; \"values.1.value\"; \"field_name\"; \"Phone\"))}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 2708,
                            "y": -1511
                        },
                        "restore": {
                            "expect": {
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "name",
                                "type": "text",
                                "label": "Variable name",
                                "required": true
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            },
                            {
                                "name": "value",
                                "type": "any",
                                "label": "Variable value"
                            }
                        ],
                        "interface": [
                            {
                                "name": "myVariable",
                                "label": "myVariable",
                                "type": "any"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

thank you so much! that worked

2 Likes