Zapier CLI动态下拉列表,如何将多个值设置为bundle.inputData [英] Zapier CLI Dynamic Dropdown, how to set multiple values to bundle.inputData
问题描述
当前正在构建Zapier应用程序,但在尝试从动态下拉列表传递信息时遇到了阻止程序.
Currently building a Zapier app but running into a blocker when trying to pass information from a dynamic dropdown.
理想情况下,只要有人选择一项,我希望能够将数据对象设置为bundle.inputData
. 文档仅提供了单一价值解决方案,但想知道是否有人知道一个解决方案?
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?
问题示例:
//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',
},
]
我希望能够将name
和email
都作为bundle.inputData
的一部分发送,而不是在用户选择项目时回传email
.
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!
推荐答案
解决方案: 在触发器中将名称/电子邮件组合为字符串,并在发出最终HTTP请求时将其分开.
Solution: Combine Name/Email as a string in trigger and separate when making final HTTP request.
示例:
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)})
}
这篇关于Zapier CLI动态下拉列表,如何将多个值设置为bundle.inputData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!