2

I am trying to dynamically render a spec (Specification) of a collection from an RPC. Can't get it to work. Here I have attached the code of both 'module->mappable parameters' and the 'remote procedure->communication' here.

module -> mappable parameters

[
    {
        "name": "birdId",
        "type": "select",
        "label": "Bird Name",
        "required": true,
        "options": {
            "store": "rpc://selectbird",
            "nested": [
                {
                    "name": "variables",
                    "type": "collection",
                    "label": "Bird Variables",
                    "spec": [
                        "rpc://birdVariables"
                    ]
                }
            ]
        }
    }
]

remote procedure -> communication

{
    "url": "/bird/get-variables",
    "method": "POST",
    "body": {
        "birdId": "{{parameters.birdId}}"
    },
    "headers": {
        "Authorization": "Apikey {{connection.apikey}}"
    },
    "response": {
        "iterate":{
            "container": "{{body.data}}"
        },
        "output": {
            "name": "{{item.name}}",
            "label": "{{item.label}}",
            "type": "{{item.type}}"
        }
    }
}

Thanks in advance.

A.R Naseef
  • 2,550
  • 3
  • 12
  • 14

2 Answers2

2

Just tried the following and it worked. According to Integromat's Docs you can use the wrapper directive for the rpc like so:

{
    "url": "/bird/get-variables",
    "method": "POST",
    "body": {
        "birdId": "{{parameters.birdId}}"
    },
    "headers": {
        "Authorization": "Apikey {{connection.apikey}}"
    },
    "response": {
        "iterate":"{{body.data}}",
        "output": {
            "name": "{{item.name}}",
            "label": "{{item.label}}",
            "type": "{{item.type}}"
        },
        "wrapper": [{
          "name": "variables",
          "type": "collection",
          "label": "Bird Variables",
          "spec": "{{output}}"
        }]
    }
}

Your mappable parameters would then look like:

[
    {
        "name": "birdId",
        "type": "select",
        "label": "Bird Name",
        "required": true,
        "options": {
            "store": "rpc://selectbird",
            "nested": "rpc://birdVariables"
        }
    }
]
1

Needing this myself. Pulling in custom fields that have different types but would like them all to show for the user to update customs fields or when creating a contact be able to update them. Not sure if best to have them all show or have a select drop down then let the user use the map for more than one.

Here is my response from a Get for custom fields. Could you show how my code should look. Got little confused as usualy look for add a value in the output and do you need two separate RPC's in integromat? Noticed your store and nested were different.


    {
    "customFields": [
        {
            "id": "5sCdYXDx5QBau2m2BxXC",
            "name": "Your Experience",
            "fieldKey": "contact.your_experience",
            "dataType": "LARGE_TEXT",
            "position": 0
        },
        {
            "id": "RdrFtK2hIzJLmuwgBtAr",
            "name": "Assisted by",
            "fieldKey": "contact.assisted_by",
            "dataType": "MULTIPLE_OPTIONS",
            "position": 0,
            "picklistOptions": [
                "Tom",
                "Jill",
                "Rick"
            ]
        },
        {
            "id": "uyjmfZwo0PCDJKg2uqrt",
            "name": "Is contacted",
            "fieldKey": "contact.is_contacted",
            "dataType": "CHECKBOX",
            "position": 0,
            "picklistOptions": [
                "I would like to be contacted"
            ]
        }
    ]
}


Scott
  • 31
  • 3