【问题标题】:Integromat - Dynamically render spec of a collection from an rpcIntegromat - 从 rpc 动态渲染集合的规范
【发布时间】:2021-01-31 18:45:41
【问题描述】:

我正在尝试从 RPC 动态呈现 collectionspec(规范)。无法让它工作。这里我附上了'module->mappable parameters'和'remote procedure->communication'的代码。

模块 -> 可映射参数

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

远程程序 -> 通信

{
    "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}}"
        }
    }
}

提前致谢。

【问题讨论】:

    标签: json automation integromat integromat-apps


    【解决方案1】:

    刚刚尝试了以下方法,它奏效了。根据Integromat's Docs,您可以将wrapper 指令用于rpc,如下所示:

    {
        "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}}"
            }]
        }
    }
    

    您的mappable parameters 将如下所示:

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

    【讨论】:

      【解决方案2】:

      我自己也需要这个。拉入具有不同类型但希望它们全部显示以供用户更新自定义字段或在创建联系人时能够更新它们的自定义字段。不确定是否最好让它们全部显示或有一个选择下拉菜单,然后让用户使用地图不止一个。

      这是我对自定义字段的 Get 响应。你能展示一下我的代码应该是什么样子吗?像往常一样在输出中添加一个值时有点困惑,您是否需要在 integromat 中使用两个单独的 RPC?注意到你的 store 和 nested 是不同的。

      
          {
          "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"
                  ]
              }
          ]
      }
      
      
      

      【讨论】:

        猜你喜欢
        • 2013-01-04
        • 2016-05-19
        • 1970-01-01
        • 2011-12-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-21
        相关资源
        最近更新 更多