# Send staged invoice payment reminders with Microsoft SQL: n8n workflow

> Started by a clock, and works across Gmail. 42 steps, 8 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

Source: https://millionrounds.com/workflow/send-staged-invoice-payment-reminders-with-microsoft-sql (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Money admin](https://millionrounds.com/workflows?category=Money+admin#library)

# Send staged invoice payment reminders with Microsoft SQL

Started by a clock, and works across Gmail. 42 steps, 8 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsend-staged-invoice-payment-reminders-with-microsoft-sql)

**42 steps** Large: read it before trusting it with anything live

**8** Branches: places the flow splits

**1** Loop or waits

**1** Service it connects to

## The flow

Starts it 1 Logic 21 Service 20

The steps in the order they run, from what starts it.

- 1 **Daily at 9 AM** Schedule trigger *Starts it*
- 2 **Fetch Unpaid Invoices** Microsoft Sql *Service*
- 3 **Has Unpaid Invoices?** If *Logic*
- 4 **Process Each Invoice** Split In Batches *Logic*
- 5 **No Invoices to Process** Set *Logic*
- 6 **Merge All Stages** Merge *Logic*
- 7 **Calculate Days Until Due** Date Time *Logic*
- 8 **Aggregate Summary** Aggregate *Logic*
- 9 **Route to Reminder Stage** Switch *Logic*
- 10 **Generate Summary Report** Set *Logic*
- 11 **Already Sent 7 Before?** If *Logic*
- 12 **Already Sent 3 Before?** If *Logic*
- 13 **Already Sent Due Today?** If *Logic*
- 14 **Already Sent 1 Overdue?** If *Logic*
- 15 **Already Sent 7 Overdue?** If *Logic*
- 16 **Already Sent 15 Overdue?** If *Logic*
- 17 **Create HTML Report** Html *Logic*
- 18 **Prepare Email 7 Before** Set *Logic*
- 19 **Prepare Email 3 Before** Set *Logic*
- 20 **Prepare Email Due Today** Set *Logic*
- 21 **Prepare Email 1 Overdue** Set *Logic*
- 22 **Prepare Email 7 Overdue** Set *Logic*
- 23 **Prepare Email 15 Overdue** Set *Logic*
- 24 **Send Summary to Finance** Gmail *Service*
- 25 **Send Email 7 Before** Gmail *Service*
- 26 **Send Email 3 Before** Gmail *Service*
- 27 **Send Email Due Today** Gmail *Service*
- 28 **Send Email 1 Overdue** Gmail *Service*
- 29 **Send Email 7 Overdue** Gmail *Service*
- 30 **Send Email 15 Overdue** Gmail *Service*
- 31 **Update DB 7 Before** Microsoft Sql *Service*
- 32 **Update DB 3 Before** Microsoft Sql *Service*
- 33 **Update DB Due Today** Microsoft Sql *Service*
- 34 **Update DB 1 Overdue** Microsoft Sql *Service*
- 35 **Update DB 7 Overdue** Microsoft Sql *Service*
- 36 **Update DB 15 Overdue** Microsoft Sql *Service*
- 37 **Log Audit 7 Before** Microsoft Sql *Service*
- 38 **Log Audit 3 Before** Microsoft Sql *Service*
- 39 **Log Audit Due Today** Microsoft Sql *Service*
- 40 **Log Audit 1 Overdue** Microsoft Sql *Service*
- 41 **Log Audit 7 Overdue** Microsoft Sql *Service*
- 42 **Log Audit 15 Overdue** Microsoft Sql *Service*

## How it's built

- **Starts on:** A clock
- **Steps:** 42, with 8 branches, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account, plus your own Gmail account. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a clock.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Take your time. At 42 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 42 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsend-staged-invoice-payment-reminders-with-microsoft-sql)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)

## Workflows like it

Also money admin, with the same services where possible, closest in size first.

- [**Gmail invoice reader with Ollama** 40 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/gmail-invoice-reader-with-ollama)
- [**WhatsApp productivity assistant with OpenAI and Gmail** 47 steps · calls a model · Gmail, Google Calendar](https://millionrounds.com/workflow/whatsapp-productivity-assistant-with-openai-and-gmail)
- [**Invoice verification and validation with Gmail and Drive** 34 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/invoice-verification-and-validation-with-gmail-and-drive)
- [**Automate SaaS operations with OpenAI** 33 steps · calls a model · Gmail, n8n data table](https://millionrounds.com/workflow/automate-saas-operations-with-openai)
- [**GPT 4.1-mini proposal to payment lifecycle management** 33 steps · calls a model · Gmail, n8n data table](https://millionrounds.com/workflow/gpt-4-1-mini-proposal-to-payment-lifecycle-management)
- [**Credit card payment reminder & tracking-for Taiwan banks** 31 steps · Gmail, Google Calendar](https://millionrounds.com/workflow/credit-card-payment-reminder-and-tracking-for-taiwan-banks)
