【问题标题】:How to make dynamic fields in zapier platform?zapier平台如何制作动态字段?
【发布时间】:2019-11-10 06:42:28
【问题描述】:

我想在 Zapier 平台中制作动态字段。如果用户选择“是”,则显示 4-5 个字段,否则不显示。 我在 ZOHO CRM 集成中看到过这种类型的示例 where only 2 fields are shown at first.

现在只有 2 个字段。当我们在第一个字段中选择“标准”时,会显示/打开许多字段。 Here are all the fields that show up

与此类似,我想要一个包含“是”和“否”两个选项的字段。 如果用户选择是,则应打开 4-5 个字段(否则不打开)。用户可以使用字段发送数据。

【问题讨论】:

    标签: zapier zapier-cli


    【解决方案1】:

    有关于这个过程的文档here(复制如下)

    const recipeFields = (z, bundle) => {
      const response = z.request('http://example.com/api/v2/fields.json');
      // json is is [{"key":"field_1"},{"key":"field_2"}]
      return response.then(res => res.json);
    };
    
    const App = {
      //...
      creates: {
        create_recipe: {
          //...
          operation: {
            // an array of objects is the simplest way
            inputFields: [
              {
                key: 'title',
                required: true,
                label: 'Title of Recipe',
                helpText: 'Name your recipe!'
              },
              {
                key: 'style',
                required: true,
                choices: { mexican: 'Mexican', italian: 'Italian' }
              },
              recipeFields // provide a function inline - we'll merge the results!
            ],
            perform: () => {}
          }
        }
      }
    };
    

    在您的情况下,您将用您的是/否替换 style 字段。 recipeFields 函数将有一个 if 语句检查 bundle.inputData.style 的值并返回更多字段对象或 [],具体取决于是否应显示更多字段。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-19
    • 2023-01-04
    • 2021-08-28
    • 2022-01-13
    • 2019-04-18
    • 1970-01-01
    • 2020-06-09
    • 2018-05-20
    相关资源
    最近更新 更多