Best answer

Add filter to response

  • 23 June 2020
  • 2 replies
  • 947 views

Userlevel 2
Badge

I need to pull custom field data, but only if CustomField=true.

 

This is not working and I am sure it is a simple fix.

 

Line 20.

 

return z.request(options).then((response) => {
  response.throwForStatus();
  const results = response.json;

  const col = results["DatabaseColumns"].map((item) => {
    return {
      ...item,
      id: item["ColumnName"],
      if 'IsCustom': true,
    };
  });

icon

Best answer by hank3rd 16 July 2020, 22:46

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +12

I’m sorry that we weren’t able to help you with this one @hank3rd 😞

 

I saw that you posted your question on Stack Overflow - if you do get a response there it would be fantastic if you could share it here in case someone has a similar question. Thanks!

Userlevel 2
Badge

I was able to find a solution:

 

I was able to find a solution!

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});