Skip to main content

What we need to do:

Foreach Line item  in order do a lookup in table to find matching rows and return that rows as result

 

When we do a test run we receive following output: 

ID

AD5l9WavzQVmPkPbzEhp8B7baTLu129E

runtime_meta

Runtime Meta Memory Used Mb

77

Runtime Meta Duration Ms

392

Runtime Meta Logs

Runtime Meta Async

true

 

The code used is : 

const nameToLookup = inputData.Name;

async function repeat(nameToLookup) {
const result = l]
nameToLookup.split(",").forEach(function (item) {
const response = fetch(`https://api.zapier.com/v1/tables/01J6VZ03B4FTXXN29VTZTHW9P8/rows?filteriProduct]=${encodeURIComponent(item)}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.ZAPIER_API_KEY}`,
'Content-Type': 'application/json'
}
}).then(
data => {
result.push(data.json())
}
)
});

return result;
}

const data = await repeat(nameToLookup);

output = data.length > 0 ? data 0] : {};

 

Hi @Wemessage 

Help links for using Code Zap app: https://zapier.com/apps/code/help

Output needs to be like this:

 


Hi @Troy Tessalone,

 

i think we have problem with missing API key .. can’t find where we can get one.

 

That is why we get no answer back.


@Wemessage 

Are you using a Code step in a Zap OR are you trying to build a Zap app integration using the Zapier Developer Platform?


Hi @Troy Tessalone ,

 

we are using code builder in ZAP.