如何在zapier平台中制作动态字段?

时间:2019-06-28 09:49:11

标签: zapier zapier-cli

我想在Zapier平台中创建动态字段。如果用户选择“是”,则显示4-5个字段,否则不显示。 我已经在ZOHO CRM集成中看到了此类示例 where only 2 fields are shown at first

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

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

1 个答案:

答案 0 :(得分:0)

有关此过程的文档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的值,并根据是否显示更多字段而返回更多字段对象或[]

相关问题