Thanks to these forums (AKA thanks to Troy), I’ve managed to built my private trigger and it’s working! Almost perfectly.
Issue: The trigger pulls invoice without an invoice number. It’s a 2 minute polling trigger. Here’s a screenshot from the live zap run (note the empty ‘invoice number’ field’)
And here’s a screenshot from a test I just ran. The invoice number is populated.
My best guess: Normally after I send an invoice in the app, it has its invoice number as ‘unassigned’ for a few seconds, and THEN populates a number. I’m guessing that the trigger is pulling the invoice data before it’s been assigned a number.
What I don’t know is how to get around that. Any ideas?
References
Code:
const options = {
url: 'https://api.payday.is/invoices/?include=lines&excludeStatus=draft,credit,cancelled,paid',
method: 'GET',
headers: {
'X-CLIENT-ID': bundle.authData.ClientID,
'X-CLIENT-SECRET': bundle.authData.ClientSecret,
'Api-Version': 'alpha',
'Authorization': bundle.authData.accessToken
},
params: {
'perpage': 10,
'page': 1
},
removeMissingValuesFrom: {
'body': false,
'params': false
},
};
return z.request(options).then((response) => {
response.throwForStatus();
const results = response.json.invoices;
return results;
});