[英]Zapier Dynamic Custom Fields
I am trying to offer custom fields from a platform as input fields I have done this in the past with another platform and with Zapiers older UI.我正在尝试提供来自平台的自定义字段作为输入字段,我过去曾使用另一个平台和 Zapiers 旧 UI 完成此操作。 It does not seem to be that simple now.现在好像没那么简单了。
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});
That is what I am trying to use for the Action.这就是我试图用于 Action 的内容。 I am using this same does for a Trigger and it works there, but not as Dynamic Field Option along with other standard inputs.我对触发器使用了同样的功能,它可以在那里工作,但不能作为动态字段选项和其他标准输入一起使用。
Not sure if I need to tweak the code or if I can invoke the data that the Trigger would pull?不确定我是否需要调整代码或者是否可以调用触发器将拉取的数据?
Here is the visual of the fields, but I need it to pull and offer the custom fields.这是字段的视觉效果,但我需要它来提取和提供自定义字段。 This would be like favorite color, etc.这就像最喜欢的颜色等。
Any help is appreciated.任何帮助表示赞赏。
I was able to use this code:我能够使用此代码:
// 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"
},
*/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.