Question

Inconsistent outcomes when generating multi-line Xero invoices

  • 8 January 2024
  • 8 replies
  • 48 views

Userlevel 2
Badge +1

Hi community,

I’ve created a Zap that creates a multi-line invoice in Xero from multiple Smartsheet rows with the same invoice number (along the lines of what @SamB suggested in this thread).

I have some Path logic built in to determine whether the triggering row is the first in sequence. If it is, it creates a new invoice. If not, it waits a short while and then looks for the invoice and if it finds it, it adds a new row.

Below is the output in Xero for a test of 20 rows, of which 16 have been generated. One run (row 7) stopped with the following error message: 

A validation exception occurred, An error occurred in Xero. Check the API Status page http://status.developer.xero.com for current service status. Contact the API support team at api@xero.com for more assistance.

I’m not sure why - there’s nothing fundamentally different about the triggering row.

Of more concern are rows 4, 11 and 13, which claim to have run without error but are not showing up in the invoice. I saw this on a previous version of the Zap, where one out of four ‘successful’ runs failed to show up.

Has anyone seen such behaviour and been able to identify the root cause?

Many thanks in advance


8 replies

Userlevel 7
Badge +14

Hi @Phil Robbins 

To give us full context, please post detailed screenshots with how your Zap steps are outlined and configured, thanks.

Userlevel 2
Badge +1

Hi @Troy Tessalone,

The first block of the Zap looks like this. I have a helper column in Smartsheet that numbers any row with the same invoice number sequentially, so the idea of the first Path is to check if the triggering row is the first in sequence. If so, an invoice with the invoice number specified in the row is created. If not, we wait (for 1 minute currently) to give ‘row 1’ time to create the invoice, then we go find it.

Note: This check was introduced because without it I had multiple rows trying to look for the sales invoice and then trying to create one under the same invoice number when they couldn’t find one, resulting in errors.

The next part of the Zap checks to see if we found the invoice for any triggering row that was not ‘row 1’. If it is found, we add that row item to the invoice. If it isn’t found, we wait a further 10 minutes then do so.

For the majority of rows this setup seems to work fine, but as mentioned, it’s not giving me a consistent enough output to deploy.

Userlevel 7
Badge +14

@Phil Robbins 

Check your Zap Runs history for activity/issues to see the DATA IN/OUT along with timestamps to help you troubleshoot: https://zapier.com/app/history/

Userlevel 2
Badge +1

@Troy Tessalone The only error description I have is shared in my original post. It points to a validation error on the Xero side but doesn’t give an error code.

For the three other rows that are missing from the invoice there are no error codes. Item 4, for example, claims to have been added successfully, but is not there.

I’m going to try building a new Zap that makes an API call to Smartsheet to GET the sheet, then use a looper to cycle through the rows. This might work better than blatting the Xero API with 20 requests in one go.

Userlevel 7
Badge +14

@Phil Robbins 

Check the DATA OUT tab.

 

Userlevel 7
Badge +14

@Phil Robbins 

Some app APIs have throttling limits, so you may have to space out the requests using a Delay After Queue.

Userlevel 2
Badge +1

@Phil Robbins

Check the DATA OUT tab.

 

@Troy Tessalone I’ve taken a look and aside from the values (which match the respective row entries in Smartsheet), there’s no difference in output between:

  • A row that was added successfully.
  • A row that claimed to be added but wasn’t.
  • The row with the validation exception.

Thanks for the Delay After Queue tip - if I get to the bottom of the rest of this I’ll drop that in there.

Userlevel 2
Badge +1

I’ve built a new Zap, details of which can be found within this thread. It’s way more efficient as it only runs once per invoice as opposed to once per line item, and only uses 2 tasks when running. Plus, it actually adds all the rows to the invoice. 

This thread can now be closed.

Thanks for the help @Troy Tessalone

Reply