如何解决Zapier动态自定义字段
我试图提供平台中的自定义字段作为输入字段,而我过去使用其他平台和Zapiers旧版UI来完成此操作。现在看来还不那么简单。
const options = {
url: 'https://edapi.campaigner.com/v1/Database',method: 'GET',headers: {
'X-API-KEY': bundle.authData.ApiKey
},params: {
'ApiKey': bundle.authData.ApiKey
}
};
return z.request(options).then((response) => {
response.throwForStatus();
const results = response.json;
const col = results.DatabaseColumns.filter((item) => item.IsCustom).map((item) => {
return {
...item,id: item["ColumnName"],};
});
return col});
这就是我要用于该操作的内容。我在触发器上使用了相同的功能,并且可以在其中使用,但不能与其他标准输入一起用作“动态字段选项”。
不确定是否需要调整代码或是否可以调用触发器将提取的数据?
这是字段的外观,但我需要它来拉出并提供自定义字段。这就像喜欢的颜色,等等。
感谢您的帮助。
解决方法
我可以使用以下代码:
// Configure a request to an endpoint of your api that
// returns custom field meta data for the authenticated
// user. Don't forget to congigure authentication!
const options = {
url: 'https://edapi.campaigner.com/v1/Database',method: 'GET',headers: {
'X-API-KEY': bundle.authData.ApiKey
},params: {
'ApiKey': bundle.authData.ApiKey
}
};
return z.request(options).then((response) => {
response.throwForStatus();
const results = response.json;
var col = results.DatabaseColumns.filter((item) => item.IsCustom).map((item) => {
return {
...item,key: item["ColumnName"],value: item["ColumnName"]
};
});
//var col = col.filter(items => ['FirstName','LastName'].indexOf(items) >= 0 )
for (var i = col.length; i--;) {
if (col[i].key === 'FirstName' || col[i].key === 'LastName' ) {
col.splice(i,1);
}
}
return col});
/*
return [
{
"key": "FirstName","value":"First Name"
},{
"key": "LastName","value": "Last Name"
},{
"key": "Test","value": "Test 2"
},*/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。