Sync latest LPF invoice ID from Xero reference

Recipe ToolsAccountingSales Enablement

What it does

When someone calls this automation with a reference number, it searches Xero for matching invoices. It returns the ID of the most recent one by due date, or stops with an error if none match.

Who it's for

Accounting teams who need to retrieve the latest invoice ID from Xero by reference number for downstream processes.

How teams use this

Retrieve invoice ID for payment processing

Call this automation from a payment workflow with a reference number to get the latest invoice ID in Xero. That ID flows into the next step without manual lookup.

Embed in customer support ticket flow

Route support tickets to this automation so agents can find the most recent invoice ID by reference without leaving their ticketing system. The same logic applies to a new channel.

Add a fallback for missing invoices

Extend the automation to check a secondary reference field in Xero if the first search returns no results. Only then does it stop with an error so fewer calls fail.

How it works

  1. Receive the reference number. Someone calls this automation in real time with an invoice reference number to look up.
  2. Search Xero for invoices. Search Xero bills and invoices by the reference number provided. If no results return, the automation stops with an error message.
  3. Find the most recent invoice. Loop through each invoice and compare due dates in the Asia/Singapore timezone. Track the invoice ID with the latest due date and return it to the caller.
  4. Return the invoice ID. Send back the invoice ID of the most recent match so the caller can use it in the next step of their process.