Emails customers a polite reminder with the invoice attached at 3, 14 and 30 days overdue, and sends you a morning summary of what's owed.

UsesGmailQuickBooks Online

Chase overdue QuickBooks invoices

Unpaid invoices slip past their due date, and chasing them by hand is awkward and easy to forget, so cash comes in late. Every weekday morning this reads the overdue invoices in QuickBooks and emails each customer a polite reminder from your Gmail, with the invoice PDF attached: a friendly note at 3 days overdue, a follow-up at 14 and a firmer one at 30. A customer with several overdue invoices gets one email covering them. You get one short summary that leads with the number that matters, such as 'Chased 4 invoices · $12,480.00 overdue across 9 invoices', then lists what went out and everything still owed.

Each invoice gets each reminder once. What was sent is recorded, so a rerun never repeats an email, and a reminder that falls on a weekend goes out on Monday. Until you switch sending on, every run is a preview: nothing reaches your customers, and you get each kind of reminder written out in full to check. An invoice with no email address in QuickBooks is listed for you rather than skipped, totals in different currencies are never added together, and if QuickBooks can't be read or a reminder can't be sent, the run says so and is marked failed instead of passing for a quiet morning.

You need QuickBooks Online and Gmail connected, and the email address the summary should go to. Switch on sending to customers once the preview looks right.

ScheduleRun every weekday at 09:00.Run every weekday at 09:00.
ValuesSet summaryEmail to blank.Set summaryEmail to blank.
ValuesSet sendToCustomers to false.Set sendToCustomers to false.
ValuesSet signOffName to blank.Set signOffName to blank.
ValuesSet firstReminderDays to 3.Set firstReminderDays to 3.
ValuesSet secondReminderDays to 14.Set secondReminderDays to 14.
ValuesSet thirdReminderDays to 30.Set thirdReminderDays to 30.
ValuesSet liveMode to false.Set liveMode to false.
Decisions & LoopsIf sendToCustomers is yesIf sendToCustomers is yes
Yes
ValuesChange liveMode to true.Change liveMode to true.
Else if @sendToCustomers isn't no
Decisions & LoopsStop and report a problem: Set the 'sendToCustomers' step to true to email reminders to your customers, or to false to get a preview of them in your own inbox first. Nothing was sent.Stop and report a problem: Set the 'sendToCustomers' step to true to email reminders to your customers, or to false to get a preview of them in your own inbox first. Nothing was sent.
Otherwise
No steps
Dates & TimesGet today's date and save it as today.Get today's date and save it as today.
ValuesSet reminderHistory to an empty list.Set reminderHistory to an empty list.
Decisions & LoopsIf a step below fails, save the error as historyErrorIf a step below fails, save the error as historyError
Try
Stored ValuesGet the stored value 'invoice_reminder_history'. Save it as storedHistory.Get the stored value 'invoice_reminder_history'. Save it as storedHistory.
Decisions & LoopsIf storedHistory.found is yesIf storedHistory.found is yes
Yes
ValuesChange reminderHistory to storedHistory.value.Change reminderHistory to storedHistory.value.
No
No steps
On error
Decisions & LoopsStop and report a problem: Couldn't read the record of reminders already sent, so nothing was sent this morning: that record is what stops a customer being chased twice. Lodol said: historyError.message.Stop and report a problem: Couldn't read the record of reminders already sent, so nothing was sent this morning: that record is what stops a customer being chased twice. Lodol said: historyError.message.
ValuesSet businessName to blank.Set businessName to blank.
ValuesSet overdueInvoices to an empty list.Set overdueInvoices to an empty list.
ValuesSet nextPage to 1.Set nextPage to 1.
ValuesSet morePages to true.Set morePages to true.
Decisions & LoopsIf a step below fails, save the error as quickbooksErrorIf a step below fails, save the error as quickbooksError
Try
Decisions & LoopsIf signOffName is blankIf signOffName is blank
Yes
QuickBooks OnlineQuickBooks OnlineGet QuickBooks company info. Save it as company.Get QuickBooks company info. Save it as company.
TextTrim company.CompanyInfo.CompanyName and save it as businessName.Trim company.CompanyInfo.CompanyName and save it as businessName.
No
TextTrim signOffName and save it as businessName.Trim signOffName and save it as businessName.
Decisions & LoopsWhile morePages is yes:While morePages is yes:
QuickBooks OnlineQuickBooks Online List up to 1000 QuickBooks invoices. Save it as overduePage. List up to 1000 QuickBooks invoices. Save it as overduePage.
Lists Combine overdueInvoices and overduePage.QueryResponse.Invoice into one list and save it as overdueInvoices. Combine overdueInvoices and overduePage.QueryResponse.Invoice into one list and save it as overdueInvoices.
Values Change morePages to overduePage.has_more. Change morePages to overduePage.has_more.
Values Change nextPage to overduePage.next_start_position. Change nextPage to overduePage.next_start_position.
On error
Decisions & LoopsStop and report a problem: QuickBooks couldn't be read, so no reminders were sent this morning. Check that QuickBooks is still connected in Lodol. QuickBooks said: quickbooksError.message.Stop and report a problem: QuickBooks couldn't be read, so no reminders were sent this morning. Check that QuickBooks is still connected in Lodol. QuickBooks said: quickbooksError.message.
Decisions & LoopsIf businessName is blankIf businessName is blank
Yes
Decisions & LoopsStop and report a problem: Your QuickBooks company has no name to sign the reminders with. Put the name to sign off with in the 'signOffName' step at the top of this workflow, then run it again. Nothing was sent.Stop and report a problem: Your QuickBooks company has no name to sign the reminders with. Put the name to sign off with in the 'signOffName' step at the top of this workflow, then run it again. Nothing was sent.
No
No steps
ListsKeep only Id, DocNumber, TxnDate, DueDate, Balance, TotalAmt, CurrencyRef, CustomerRef, and BillEmail in overdueInvoices and save it as overdueInvoices.Keep only Id, DocNumber, TxnDate, DueDate, Balance, TotalAmt, CurrencyRef, CustomerRef, and BillEmail in overdueInvoices and save it as overdueInvoices.
ListsSort overdueInvoices by DueDate, smallest first and save it as overdueInvoices.Sort overdueInvoices by DueDate, smallest first and save it as overdueInvoices.
ListsMatch overdueInvoices with reminderHistory by Id and invoice_id and save it as overdueInvoices.Match overdueInvoices with reminderHistory by Id and invoice_id and save it as overdueInvoices.
ValuesSet overdueNow to an empty list.Set overdueNow to an empty list.
ValuesSet remindersDue to an empty list.Set remindersDue to an empty list.
ValuesSet stillOverdueLines to an empty list.Set stillOverdueLines to an empty list.
ValuesSet updatedHistory to an empty list.Set updatedHistory to an empty list.
Decisions & LoopsFor each invoice in overdueInvoices:For each invoice in overdueInvoices:
Dates & TimesCount the days from invoice.DueDate to today and save it as daysOverdue.Count the days from invoice.DueDate to today and save it as daysOverdue.
Decisions & LoopsIf daysOverdue is less than 1 or invoice.Balance is less than or equal to 0If daysOverdue is less than 1 or invoice.Balance is less than or equal to 0
Yes
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ListsAdd a record of currency and balance to the end of overdueNow and save it as overdueNow.Add a record of currency and balance to the end of overdueNow and save it as overdueNow.
ValuesSet stageReached to 0.Set stageReached to 0.
Decisions & LoopsIf daysOverdue is greater than or equal to thirdReminderDaysIf daysOverdue is greater than or equal to thirdReminderDays
Yes
ValuesChange stageReached to 3.Change stageReached to 3.
Else if @daysOverdue is greater than or equal to @secondRem…
ValuesChange stageReached to 2.Change stageReached to 2.
Else if @daysOverdue is greater than or equal to @firstRemi…
ValuesChange stageReached to 1.Change stageReached to 1.
Otherwise
No steps
ValuesSet stageSent to 0.Set stageSent to 0.
ValuesSet stageFlagged to 0.Set stageFlagged to 0.
Decisions & LoopsIf invoice.due_date is invoice.DueDateIf invoice.due_date is invoice.DueDate
Yes
ValuesChange stageSent to invoice.reminder_stage.Change stageSent to invoice.reminder_stage.
ValuesChange stageFlagged to invoice.flagged_stage.Change stageFlagged to invoice.flagged_stage.
ListsAdd a record of invoice id, due date, reminder stage, and flagged stage to the end of updatedHistory and save it as updatedHistory.Add a record of invoice id, due date, reminder stage, and flagged stage to the end of updatedHistory and save it as updatedHistory.
No
No steps
ValuesSet numberStyle to thousands.Set numberStyle to thousands.
Decisions & LoopsIf the length of invoice.CurrencyRef.value is 3If the length of invoice.CurrencyRef.value is 3
Yes
ValuesChange numberStyle to currency.Change numberStyle to currency.
No
No steps
MathFormat invoice.Balance as a number and save it as balanceText.Format invoice.Balance as a number and save it as balanceText.
ValuesSet amountText to balanceText.Set amountText to balanceText.
Decisions & LoopsIf invoice.Balance is less than invoice.TotalAmtIf invoice.Balance is less than invoice.TotalAmt
Yes
MathFormat invoice.TotalAmt as a number and save it as totalText.Format invoice.TotalAmt as a number and save it as totalText.
TextBuild the text @balanceText still to pay of @totalText and save it as amountText.Build the text @balanceText still to pay of @totalText and save it as amountText.
No
No steps
Dates & TimesMake invoice.DueDate readable as “November 2, 2026” and save it as dueDateText.Make invoice.DueDate readable as “November 2, 2026” and save it as dueDateText.
ValuesSet invoiceName to invoice.DocNumber.Set invoiceName to invoice.DocNumber.
Decisions & LoopsIf invoice.DocNumber is emptyIf invoice.DocNumber is empty
Yes
Dates & TimesMake invoice.TxnDate readable as “November 2, 2026” and save it as issuedText.Make invoice.TxnDate readable as “November 2, 2026” and save it as issuedText.
ValuesChange invoiceName to dated issuedText.Change invoiceName to dated issuedText.
No
No steps
ValuesSet daysText to daysOverdue days overdue.Set daysText to daysOverdue days overdue.
Decisions & LoopsIf daysOverdue is 1If daysOverdue is 1
Yes
ValuesChange daysText to 1 day overdue.Change daysText to 1 day overdue.
No
No steps
TextBuild the text • @invoice.CustomerRef.name, invoice @invoiceName: @amountText, @daysText and save it as summaryLine.Build the text • @invoice.CustomerRef.name, invoice @invoiceName: @amountText, @daysText and save it as summaryLine.
Decisions & LoopsIf stageReached is greater than stageSentIf stageReached is greater than stageSent
Yes
ListsMerge a record of stage reached, stage sent, stage flagged, and 5 more into invoice and save it as dueForReminder.Merge a record of stage reached, stage sent, stage flagged, and 5 more into invoice and save it as dueForReminder.
ListsAdd dueForReminder to the end of remindersDue and save it as remindersDue.Add dueForReminder to the end of remindersDue and save it as remindersDue.
No
ValuesSet progress to first reminder goes out at firstReminderDays days overdue.Set progress to first reminder goes out at firstReminderDays days overdue.
Decisions & LoopsIf stageSent is 3If stageSent is 3
Yes
ValuesChange progress to third and last reminder sent.Change progress to third and last reminder sent.
Else if @stageSent is 2
TextBuild the text second reminder sent; the third goes out at @thirdReminderDays days overdue and save it as progress.Build the text second reminder sent; the third goes out at @thirdReminderDays days overdue and save it as progress.
Else if @stageSent is 1
TextBuild the text first reminder sent; the second goes out at @secondReminderDays days overdue and save it as progress.Build the text first reminder sent; the second goes out at @secondReminderDays days overdue and save it as progress.
Otherwise
No steps
ListsAdd summaryLine (progress) to the end of stillOverdueLines and save it as stillOverdueLines.Add summaryLine (progress) to the end of stillOverdueLines and save it as stillOverdueLines.
ListsGroup the items in remindersDue by CustomerRef.value and save it as customersToChase.Group the items in remindersDue by CustomerRef.value and save it as customersToChase.
ValuesSet chasedLines to an empty list.Set chasedLines to an empty list.
ValuesSet chasedCount to 0.Set chasedCount to 0.
ValuesSet noEmailLines to an empty list.Set noEmailLines to an empty list.
ValuesSet problems to an empty list.Set problems to an empty list.
ValuesSet examples to an empty list.Set examples to an empty list.
ValuesSet sampledStages to an empty list.Set sampledStages to an empty list.
ValuesSet sampleAttachments to an empty list.Set sampleAttachments to an empty list.
ValuesSet sentVerb to would go to .Set sentVerb to would go to .
Decisions & LoopsIf liveMode is yesIf liveMode is yes
Yes
ValuesChange sentVerb to sent to .Change sentVerb to sent to .
No
No steps
Decisions & LoopsFor each customer in customersToChase:For each customer in customersToChase:
ListsGet the first item of customer.items and save it as firstInvoice.Get the first item of customer.items and save it as firstInvoice.
ListsGet BillEmail.Address from every item in customer.items and save it as billEmails.Get BillEmail.Address from every item in customer.items and save it as billEmails.
ListsRemove duplicates and empty items from billEmails and save it as knownEmails.Remove duplicates and empty items from billEmails and save it as knownEmails.
TextJoin knownEmails with , and save it as sendTo.Join knownEmails with , and save it as sendTo.
Decisions & LoopsIf customer.key is blankIf customer.key is blank
Yes
ValuesChange sendTo to blank.Change sendTo to blank.
No
No steps
Decisions & LoopsIf sendTo is blank and customer.key isn't blankIf sendTo is blank and customer.key isn't blank
Yes
Decisions & LoopsIf a step below fails, save the error as lookupErrorIf a step below fails, save the error as lookupError
Try
QuickBooks OnlineQuickBooks OnlineGet QuickBooks customer customer.key. Save it as customerRecord.Get QuickBooks customer customer.key. Save it as customerRecord.
TextTrim customerRecord.Customer.PrimaryEmailAddr.Address and save it as sendTo.Trim customerRecord.Customer.PrimaryEmailAddr.Address and save it as sendTo.
On error
ListsAdd • firstInvoice.CustomerRef.name: couldn't look up their email address in QuickBooks (lookupError.message), so no reminder went out. It will be tried again on the next run. to the end of problems and save it as problems.Add • firstInvoice.CustomerRef.name: couldn't look up their email address in QuickBooks (lookupError.message), so no reminder went out. It will be tried again on the next run. to the end of problems and save it as problems.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
Decisions & LoopsIf sendTo is blankIf sendTo is blank
Yes
Decisions & LoopsFor each unreachable in customer.items:For each unreachable in customer.items:
Decisions & Loops If unreachable.stage_reached is greater than unreachable.stage_flagged If unreachable.stage_reached is greater than unreachable.stage_flagged
Yes
ListsAdd unreachable.summary_line: there's no email address on the invoice or on the customer in QuickBooks, so it can't be chased. Add one and its reminder goes out on the next run. to the end of noEmailLines and save it as noEmailLines.Add unreachable.summary_line: there's no email address on the invoice or on the customer in QuickBooks, so it can't be chased. Add one and its reminder goes out on the next run. to the end of noEmailLines and save it as noEmailLines.
ListsKeep each item in updatedHistory where item.invoice_id is not unreachable.Id and save it as historyWithoutUnreachable.Keep each item in updatedHistory where item.invoice_id is not unreachable.Id and save it as historyWithoutUnreachable.
ListsAdd a record of invoice id, due date, reminder stage, and flagged stage to the end of historyWithoutUnreachable and save it as updatedHistory.Add a record of invoice id, due date, reminder stage, and flagged stage to the end of historyWithoutUnreachable and save it as updatedHistory.
No
ListsAdd unreachable.summary_line (no email address in QuickBooks, so not chased) to the end of stillOverdueLines and save it as stillOverdueLines.Add unreachable.summary_line (no email address in QuickBooks, so not chased) to the end of stillOverdueLines and save it as stillOverdueLines.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ListsGet stage_reached from every item in customer.items and save it as stagesReached.Get stage_reached from every item in customer.items and save it as stagesReached.
MathFind the largest number in stagesReached and save it as reminderStage.Find the largest number in stagesReached and save it as reminderStage.
ValuesSet writeEmail to true.Set writeEmail to true.
Decisions & LoopsIf liveMode is no and sampledStages contains reminderStageIf liveMode is no and sampledStages contains reminderStage
Yes
ValuesChange writeEmail to false.Change writeEmail to false.
No
No steps
Decisions & LoopsIf writeEmail is yesIf writeEmail is yes
Yes
ValuesSet invoicePdfs to an empty list.Set invoicePdfs to an empty list.
ValuesSet pdfProblem to blank.Set pdfProblem to blank.
Decisions & LoopsFor each pdfInvoice in customer.items:For each pdfInvoice in customer.items:
Decisions & Loops If a step below fails, save the error as pdfError If a step below fails, save the error as pdfError
Try
QuickBooks OnlineQuickBooks OnlineGet the PDF of QuickBooks invoice pdfInvoice. Save it as invoicePdf.Get the PDF of QuickBooks invoice pdfInvoice. Save it as invoicePdf.
ListsAdd invoicePdf.document_ref to the end of invoicePdfs and save it as invoicePdfs.Add invoicePdf.document_ref to the end of invoicePdfs and save it as invoicePdfs.
On error
TextBuild the text @pdfInvoice.summary_line: couldn't get the invoice PDF from QuickBooks (@pdfError.message), so no reminder went out. It will be tried again on the next run. and save it as pdfProblem.Build the text @pdfInvoice.summary_line: couldn't get the invoice PDF from QuickBooks (@pdfError.message), so no reminder went out. It will be tried again on the next run. and save it as pdfProblem.
Decisions & LoopsStop repeating.Stop repeating.
Decisions & LoopsIf pdfProblem isn't blankIf pdfProblem isn't blank
Yes
ListsAdd pdfProblem to the end of problems and save it as problems.Add pdfProblem to the end of problems and save it as problems.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet invoiceRef to invoice firstInvoice.invoice_name.Set invoiceRef to invoice firstInvoice.invoice_name.
ValuesSet thisInvoice to this invoice.Set thisInvoice to this invoice.
ValuesSet copyNote to A copy of the invoice is attached.Set copyNote to A copy of the invoice is attached.
Decisions & LoopsIf customer.count is greater than 1If customer.count is greater than 1
Yes
ValuesChange invoiceRef to customer.count invoices.Change invoiceRef to customer.count invoices.
ValuesChange thisInvoice to these invoices.Change thisInvoice to these invoices.
ValuesChange copyNote to A copy of each invoice is attached.Change copyNote to A copy of each invoice is attached.
No
No steps
TextBuild the text Friendly reminder: @invoiceRef from @businessName and save it as emailSubject.Build the text Friendly reminder: @invoiceRef from @businessName and save it as emailSubject.
TextBuild the text We hope all is well. This is a friendly reminder that payment for @thisInvoice is now past due: and save it as opening.Build the text We hope all is well. This is a friendly reminder that payment for @thisInvoice is now past due: and save it as opening.
TextBuild the text @copyNote for convenience. If payment is already on its way, thank you, and please disregard this note. If anything looks wrong, just reply to this email and w... and save it as closing.Build the text @copyNote for convenience. If payment is already on its way, thank you, and please disregard this note. If anything looks wrong, just reply to this email and w... and save it as closing.
Decisions & LoopsIf reminderStage is 3If reminderStage is 3
Yes
TextBuild the text Payment overdue: @invoiceRef from @businessName and save it as emailSubject.Build the text Payment overdue: @invoiceRef from @businessName and save it as emailSubject.
TextBuild the text Payment for @thisInvoice is now well past due, and we haven't yet received it: and save it as opening.Build the text Payment for @thisInvoice is now well past due, and we haven't yet received it: and save it as opening.
TextBuild the text @copyNote. We'd be grateful if you could arrange payment as soon as possible, or reply to let us know when to expect it. If something is holding it up, please ... and save it as closing.Build the text @copyNote. We'd be grateful if you could arrange payment as soon as possible, or reply to let us know when to expect it. If something is holding it up, please ... and save it as closing.
Else if @reminderStage is 2
TextBuild the text Following up: @invoiceRef from @businessName and save it as emailSubject.Build the text Following up: @invoiceRef from @businessName and save it as emailSubject.
TextBuild the text We're following up because our records still don't show payment for @thisInvoice: and save it as opening.Build the text We're following up because our records still don't show payment for @thisInvoice: and save it as opening.
TextBuild the text @copyNote. Could you let us know when we can expect payment? If you've already paid, thank you, and please let us know so we can update our records. If anythin... and save it as closing.Build the text @copyNote. Could you let us know when we can expect payment? If you've already paid, thank you, and please let us know so we can update our records. If anythin... and save it as closing.
Otherwise
No steps
ValuesSet customerLines to an empty list.Set customerLines to an empty list.
Decisions & LoopsFor each listedInvoice in customer.items:For each listedInvoice in customer.items:
Lists Add • Invoice listedInvoice.invoice_name: listedInvoice.amount_text, due listedInvoice.due_date_text (listedInvoice.days_text) to the end of customerLines and save it as customerLines. Add • Invoice listedInvoice.invoice_name: listedInvoice.amount_text, due listedInvoice.due_date_text (listedInvoice.days_text) to the end of customerLines and save it as customerLines.
TextJoin customerLines with a new line and save it as invoiceList.Join customerLines with a new line and save it as invoiceList.
ValuesSet greetName to firstInvoice.CustomerRef.name.Set greetName to firstInvoice.CustomerRef.name.
Decisions & LoopsIf greetName contains :If greetName contains :
Yes
TextGet the text before : in greetName and save it as greetName.Get the text before : in greetName and save it as greetName.
No
No steps
TextBuild the text Hi @greetName, @opening @invoiceList @closing Kind regards, @businessName and save it as reminderBody.Build the text Hi @greetName, @opening @invoiceList @closing Kind regards, @businessName and save it as reminderBody.
Decisions & LoopsIf liveMode is yesIf liveMode is yes
Yes
Decisions & LoopsIf a step below fails, save the error as sendErrorIf a step below fails, save the error as sendError
Try
GmailGmailSend an email to sendTo.Send an email to sendTo. Subject: emailSubjectreminderBody
On error
ListsAdd • firstInvoice.CustomerRef.name: the reminder for invoiceRef couldn't be sent to sendTo (sendError.message). It will be tried again on the next run. to the end of problems and save it as problems.Add • firstInvoice.CustomerRef.name: the reminder for invoiceRef couldn't be sent to sendTo (sendError.message). It will be tried again on the next run. to the end of problems and save it as problems.
Decisions & LoopsSkip to the next item.Skip to the next item.
Decisions & LoopsFor each sentInvoice in customer.items:For each sentInvoice in customer.items:
Lists Keep each item in updatedHistory where item.invoice_id is not sentInvoice.Id and save it as historyWithoutSent. Keep each item in updatedHistory where item.invoice_id is not sentInvoice.Id and save it as historyWithoutSent.
Lists Add a record of invoice id, due date, reminder stage, and flagged stage to the end of historyWithoutSent and save it as updatedHistory. Add a record of invoice id, due date, reminder stage, and flagged stage to the end of historyWithoutSent and save it as updatedHistory.
Decisions & LoopsIf a step below fails, save the error as recordErrorIf a step below fails, save the error as recordError
Try
Stored ValuesSet the stored value 'invoice_reminder_history' to updatedHistory.Set the stored value 'invoice_reminder_history' to updatedHistory.
On error
Decisions & LoopsStop and report a problem: The reminder to firstInvoice.CustomerRef.name (invoiceRef) was sent, but Lodol couldn't record it (recordError.message), so the run stopped there rather than send any more. Reminders sent before it are recorded and won't repeat, but the next run has no record of this one, so firstInvoice.CustomerRef.name will get it a second time.Stop and report a problem: The reminder to firstInvoice.CustomerRef.name (invoiceRef) was sent, but Lodol couldn't record it (recordError.message), so the run stopped there rather than send any more. Reminders sent before it are recorded and won't repeat, but the next run has no record of this one, so firstInvoice.CustomerRef.name will get it a second time.
No
ListsAdd reminderStage to the end of sampledStages and save it as sampledStages.Add reminderStage to the end of sampledStages and save it as sampledStages.
ListsCombine sampleAttachments and invoicePdfs into one list and save it as sampleAttachments.Combine sampleAttachments and invoicePdfs into one list and save it as sampleAttachments.
TextLook up reminderStage in a table and save it as sampleName.Look up reminderStage in a table and save it as sampleName.
ListsAdd ———Add ——— The sampleName, as firstInvoice.CustomerRef.name would receive it (its invoice is attached to this email) To: sendTo Subject: emailSubject reminderBody to the end of examples and save it as examples.
No
No steps
Decisions & LoopsFor each chasedInvoice in customer.items:For each chasedInvoice in customer.items:
TextLook up chasedInvoice.stage_reached in a table and save it as stageName.Look up chasedInvoice.stage_reached in a table and save it as stageName.
ListsAdd chasedInvoice.summary_line, stageName@sentVerb@sendTo to the end of chasedLines and save it as chasedLines.Add chasedInvoice.summary_line, stageName@sentVerb@sendTo to the end of chasedLines and save it as chasedLines.
ValuesAdd 1 to chasedCount.Add 1 to chasedCount.
Decisions & LoopsIf liveMode is yesIf liveMode is yes
Yes
Decisions & LoopsIf a step below fails, save the error as tidyErrorIf a step below fails, save the error as tidyError
Try
Stored ValuesSet the stored value 'invoice_reminder_history' to updatedHistory.Set the stored value 'invoice_reminder_history' to updatedHistory.
On error
ListsAdd • Couldn't update the record of reminders sent (tidyError.message). Nothing will be sent twice, but some notes in this summary may appear again next time. to the end of problems and save it as problems.Add • Couldn't update the record of reminders sent (tidyError.message). Nothing will be sent twice, but some notes in this summary may appear again next time. to the end of problems and save it as problems.
No
No steps
ListsCount the items in overdueNow and save it as overdueCount.Count the items in overdueNow and save it as overdueCount.
Decisions & LoopsIf overdueCount is 0If overdueCount is 0
Yes
Decisions & LoopsFinish the run: No overdue invoices in QuickBooks this morning, so there was nothing to chase.Finish the run: No overdue invoices in QuickBooks this morning, so there was nothing to chase.
No
No steps
ListsGroup the items in overdueNow by currency, with the total balance of each and save it as currencyTotals.Group the items in overdueNow by currency, with the total balance of each and save it as currencyTotals.
ValuesSet totalParts to an empty list.Set totalParts to an empty list.
Decisions & LoopsFor each currencyGroup in currencyTotals:For each currencyGroup in currencyTotals:
ValuesSet totalStyle to thousands.Set totalStyle to thousands.
Decisions & LoopsIf the length of currencyGroup.key is 3If the length of currencyGroup.key is 3
Yes
ValuesChange totalStyle to currency.Change totalStyle to currency.
No
No steps
MathFormat currencyGroup.total as a number and save it as groupTotalText.Format currencyGroup.total as a number and save it as groupTotalText.
ListsAdd groupTotalText to the end of totalParts and save it as totalParts.Add groupTotalText to the end of totalParts and save it as totalParts.
TextJoin totalParts with and and save it as totalsText.Join totalParts with and and save it as totalsText.
ValuesSet overdueWord to invoices.Set overdueWord to invoices.
Decisions & LoopsIf overdueCount is 1If overdueCount is 1
Yes
ValuesChange overdueWord to invoice.Change overdueWord to invoice.
No
No steps
ListsCombine problems and noEmailLines into one list and save it as attentionLines.Combine problems and noEmailLines into one list and save it as attentionLines.
Decisions & LoopsIf chasedCount is 0 and the length of attentionLines is 0 is yesIf chasedCount is 0 and the length of attentionLines is 0 is yes
Yes
Decisions & LoopsFinish the run: No reminders were due this morning. Still overdue: overdueCount overdueWord, totalsText in all. Each will be chased when it reaches its next reminder.Finish the run: No reminders were due this morning. Still overdue: overdueCount overdueWord, totalsText in all. Each will be chased when it reaches its next reminder.
No
No steps
ValuesSet chasedWord to invoices.Set chasedWord to invoices.
Decisions & LoopsIf chasedCount is 1If chasedCount is 1
Yes
ValuesChange chasedWord to invoice.Change chasedWord to invoice.
No
No steps
ValuesSet chasedPart to Preview: no reminders due.Set chasedPart to Preview: no reminders due.
Decisions & LoopsIf liveMode is yes and chasedCount is greater than 0If liveMode is yes and chasedCount is greater than 0
Yes
TextBuild the text Chased @chasedCount @chasedWord and save it as chasedPart.Build the text Chased @chasedCount @chasedWord and save it as chasedPart.
Else if @liveMode is yes
ValuesChange chasedPart to No reminders sent.Change chasedPart to No reminders sent.
Else if @chasedCount is greater than 0
TextBuild the text Preview: @chasedCount @chasedWord ready to chase and save it as chasedPart.Build the text Preview: @chasedCount @chasedWord ready to chase and save it as chasedPart.
Otherwise
No steps
TextBuild the text @chasedPart · @totalsText overdue across @overdueCount @overdueWord and save it as headline.Build the text @chasedPart · @totalsText overdue across @overdueCount @overdueWord and save it as headline.
ValuesSet previewNote to blank.Set previewNote to blank.
Decisions & LoopsIf liveMode is noIf liveMode is no
Yes
ValuesChange previewNote to:Change previewNote to:This is a preview: nothing has been sent to your customers. Below is what would have gone out this morning, with each kind of reminder written out in full at the end and its invoice attached to this email. When you're happy with them, set the 'sendToCustomers' step to true and the next run sends them for real.
No
No steps
ValuesSet attentionSection to blank.Set attentionSection to blank.
Decisions & LoopsIf attentionLines isn't emptyIf attentionLines isn't empty
Yes
TextJoin attentionLines with a new line and save it as attentionText.Join attentionLines with a new line and save it as attentionText.
TextBuild the text Needs your attention: @attentionText and save it as attentionSection.Build the text Needs your attention: @attentionText and save it as attentionSection.
No
No steps
ValuesSet chasedSection to blank.Set chasedSection to blank.
Decisions & LoopsIf chasedCount is greater than 0If chasedCount is greater than 0
Yes
TextJoin chasedLines with a new line and save it as chasedText.Join chasedLines with a new line and save it as chasedText.
ValuesSet chasedHeading to:Set chasedHeading to:Reminders that would go out this morning:
Decisions & LoopsIf liveMode is yesIf liveMode is yes
Yes
ValuesChange chasedHeading to:Change chasedHeading to:Reminders sent this morning:
No
No steps
TextBuild the text @chasedHeading@chasedText and save it as chasedSection.Build the text @chasedHeading@chasedText and save it as chasedSection.
No
No steps
ValuesSet stillOverdueSection to blank.Set stillOverdueSection to blank.
Decisions & LoopsIf stillOverdueLines isn't emptyIf stillOverdueLines isn't empty
Yes
TextJoin stillOverdueLines with a new line and save it as stillOverdueText.Join stillOverdueLines with a new line and save it as stillOverdueText.
TextBuild the text Still overdue: @stillOverdueText and save it as stillOverdueSection.Build the text Still overdue: @stillOverdueText and save it as stillOverdueSection.
No
No steps
TextJoin examples with a blank line and save it as examplesText.Join examples with a blank line and save it as examplesText.
Decisions & LoopsIf a step below fails, save the error as summaryErrorIf a step below fails, save the error as summaryError
Try
GmailGmailSend an email to summaryEmail.Send an email to summaryEmail. Subject: headlineheadline previewNote@attentionSection@chasedSection@stillOverdueSection@examplesText
On error
ListsAdd • The summary email couldn't be sent to summaryEmail (summaryError.message). to the end of problems and save it as problems.Add • The summary email couldn't be sent to summaryEmail (summaryError.message). to the end of problems and save it as problems.
Decisions & LoopsIf problems isn't emptyIf problems isn't empty
Yes
TextJoin problems with a new line and save it as problemText.Join problems with a new line and save it as problemText.
Decisions & LoopsStop and report a problem: headline. Not everything went through:Stop and report a problem: headline. Not everything went through: problemText.
No
No steps
Decisions & LoopsFinish the run: headline. The summary went to summaryEmail.Finish the run: headline. The summary went to summaryEmail.