Zapier CLI Dynamic Dropdown, how to set multiple values to bundle.inputData

隐身守侯 提交于 2020-01-25 07:58:08

问题


Currently building a Zapier app but running into a blocker when trying to pass information from a dynamic dropdown.

Ideally, I want to be able to set an object of data to bundle.inputData whenever someone selects an item. Thedocs only provide a single value solution, but wondering if anybody knows of a solution to this?

Example of the problem:

//User Data
[
  {id:1, name: Tommy, email: tom@gmail.com},
  {id:2, name: Bill, email: bill@gmail.com},
  {id:3, name: Greg, email: greg@gmail.com}
]

//Input Field as part of the operation object
inputFields: [
      {
        key: 'users',
        required: true,
        label: 'Select user to notify',
        dynamic: 'users.email.name',
      },
]

Instead of passing back an email when a user selects an item, I want to be able to send both name and email as part of the bundle.inputData.

Any ideas would be greatly appreciated!


回答1:


Solution: Combine Name/Email as a string in trigger and separate when making final HTTP request.

Example:

const combineUserEmail = (name, email) => `${name}/${email}`;

const triggerUsers = async(z, bundle) =>{
  const response = await z.request({
     url: https://blahblah.com/users
  });
  const users = z.JSON parse(response.content);
  const results = users.map((user, i) =>({id: i, user: combineUserEmail(item.name, item.email)})
}


来源:https://stackoverflow.com/questions/59740182/zapier-cli-dynamic-dropdown-how-to-set-multiple-values-to-bundle-inputdata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!