【问题标题】:Input parameter without the "name" property in custom Integromat app自定义 Integromat 应用程序中没有“名称”属性的输入参数
【发布时间】:2020-09-24 11:53:29
【问题描述】:

我正在尝试创建一个下拉参数(“选择”类型),它应该包含两组嵌套参数。但是,我不需要将此顶级参数传递给 API。我试过删除这个参数的“名称”属性,但是当模块再次打开时它不记得用户的选择。如何在请求中只包含嵌套字段,而不包含父字段?

[
  {
    "type": "select",
    "label": "Select",
    "options": [
      {
        "label": "A",
        "value": "a",
        "nested": [
          {
            "name": "a",
            "type": "text",
            "label": "a nested"
          }
        ]
      },
      {
        "label": "B",
        "value": "b",
        "nested": [
          {
            "name": "b",
            "type": "text",
            "label": "b nested"
          }
        ]
      }
    ]
  }
]

【问题讨论】:

    标签: integromat integromat-apps


    【解决方案1】:

    添加到Petr Malimánek's answer,如果您不提前知道需要删除哪些参数,您可以将它们的名称作为输入参数传递,如下所示:

    function omit(collection, ...fields) {
        const result = {};
            
        for (let key in collection) {
            if (!fields.includes(key)) {
                result[key] = collection[key];
            }
        }
            
        return result;
    }
    

    【讨论】:

      【解决方案2】:

      此时不能省略名称或排除输入参数。我们计划添加一个新标志,允许您排除像这样的特定字段,但现在您必须在模块的通信中过滤掉这个参数。

      您可以使用自定义 Javascript 函数来删除所有冗余参数。

      例如

      通讯:

      {
         "body": "{{prepareBody(body)}}"
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-10-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-05-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多