Weekly log of purchases made without an approved order

By General Input

Every Monday, add every invoice that arrived without an approved order to a running spreadsheet and get a short Slack recap of what it cost you.

Integrations

  • Coupa
  • Google Sheets
  • Slack Bot

Type

Deterministic Code

Categories

  • Finance
  • Operations

Every Monday at 6am, log every invoice that came through Coupa without a purchase order behind it, so my procurement team has a running record of off-contract buying instead of discovering it at quarter end. Run this on a cron trigger, every Monday at 6am in my timezone. Coupa does not send outgoing webhooks through this integration and is not one of the platform's poll providers, so cron is the only valid trigger here.

Use Coupa's List Invoices operation to pull invoices created in the last seven days that have no purchase order association. Filter server side with Coupa's query operators rather than scanning client side: set created_at[gt_or_eq] to the start of the seven day window as a URL encoded ISO 8601 timestamp, and use the [blank] operator set to true on the purchase order association so Coupa returns only invoices with no linked order. Coupa's Core API documents [blank] alongside [gt], [lt], [gt_or_eq] and [contains], so this is a single documented request, not a full scan.

Coupa list endpoints return at most 50 records per call and support offset based pagination only, with no cursor and no way to raise the page size. Page through by requesting 50 at a time and incrementing offset by 50 until a call returns fewer than 50 records, then stop. Remember that Coupa returns XML by default, so request JSON.

Apply a minimum invoice value threshold before anything is logged, defaulting to 500 in the instance base currency. Expose it as a named constant at the top of the workflow so it is easy to change. Invoices below the threshold are dropped entirely: they do not get a row, and they do not count toward the totals, the supplier ranking, or the week over week comparison.

For every invoice that clears the threshold, append one row to my Google Sheets log using the Append Values operation, in a fixed column order: invoice number, supplier name, amount, currency, invoice date, requester or department, and general ledger account code. Append only and never overwrite existing rows, so the sheet builds into a month over month record.

Before appending this week's rows, read the existing log with the Get Values operation and total the amounts already recorded for the previous seven day window. Use that as the baseline for the week over week comparison. If the sheet has no prior week in it, report the change as not available rather than guessing or reporting a change of zero.

Then post a short summary to my procurement Slack channel using Slack's Send a Message operation, posting as a bot. The message shows the count of invoices with no purchase order, their total value, the top three suppliers ranked by total value, and the week over week change against the baseline. Keep it short and scannable, and include a link to the log.

Keep this deterministic with no interpretation: fixed filter, fixed columns, fixed arithmetic, and no commentary or judgement about whether a given purchase was justified. If nothing matched once the threshold is applied, skip the Slack post entirely and leave the sheet untouched, so a clean week stays completely silent.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerA brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensStop cold emails to anyone with a live deal in PipedriveLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasoniMessage campaign console with pre-flight checks and delivery board