Find Salesforce renewal accounts with overdue Chargebee invoices
Give your AI agent a renewal-risk view across Salesforce and Chargebee, with explicit term dates, customer mapping and a runnable overdue-balance example.
Connect Salesforce and Chargebee through Combined to see which upcoming customer terms need a billing conversation. Aggregate subscription exposure and overdue invoices separately, then combine them by account and currency. You get a usable renewal review without multiplying one invoice across several subscriptions.
Start with the business decision
Ask: “Which accounts have subscription terms ending in the next 30 days, and what overdue balance should the account owner know about?” The result is a preparation list for renewal conversations. It should show upcoming terms, scheduled cancellations, overdue invoices and the responsible CRM account.
An account can have a billing problem without every subscription being delinquent. Keep the result at account level unless an invoice-to-subscription relationship supports a more detailed assignment. This matters when billing consolidates several subscriptions into one invoice.
Connect the records the question needs
Add Salesforce and Chargebee in Combined. Sync Salesforce Account and discover available owner fields when the review needs them. Chargebee's referenced datasets include customer, subscription and invoice. Grant these sources to your agent and inspect their actual logical schemas.
Prepare customer IDs, subscription status and term end, invoice status, due date, remaining balance and currency. Chargebee distinguishes active from non_renewing: the latter is scheduled to end at the current term boundary. Keep that cancellation signal visible. Chargebee subscription reference.
Make the identity map explicit
Maintain a Salesforce account ID to Chargebee customer ID map. Each billing customer must resolve to one reporting account; several customers can roll into the same account. Store business-entity or site identifiers too when customer IDs are only unique within that boundary.
In the fixture, Atlas maps to cb1, which has two upcoming subscriptions and one overdue invoice. Aggregate those subscriptions once and the invoices once before joining. Matching by company name, joining raw invoice rows to subscription rows, or counting invoice line items would produce a different and misleading result.
Define the metric and reporting window
The example takes a September 10, 2026 UTC snapshot. Upcoming term ends are at or after September 10 and before October 10. Include active and non-renewing subscriptions; report their counts separately. Exclude already canceled subscriptions and a term ending exactly at the October 10 boundary.
Overdue means positive unpaid invoice balance, a qualifying unpaid status, and a due timestamp before the snapshot. The example uses payment_due and not_paid. Chargebee's amount_due already reflects its invoice adjustments; avoid subtracting the same credits again. USD minor units are divided by 100 here. Keep other currencies separate. Invoice balance definition.
Run the worked example
Atlas has two upcoming terms but only one $500 overdue invoice. A future-due $800 invoice does not enter the overdue balance. Birch's term is non-renewing, while an invoice due on the snapshot date is not yet overdue under this rule. Cedar's canceled subscription never enters the renewal cohort.
Download the runnable SQL fixture and its expected result. The fixture uses synthetic records and normalized teaching tables. Run it in DuckDB; discover your own Combined datasets before adapting the calculation.
| Account | Currency | Upcoming terms | Non-renewing | Overdue invoices | Overdue balance |
|---|---|---|---|---|---|
| Atlas | USD | 2 | 0 | 1 | $500 |
| Birch | USD | 1 | 1 | 0 | $0 |
Give your agent an exact assignment
Use my granted Salesforce and Chargebee sources in Combined.
Discover Account, customer, subscription and invoice datasets and fields.
Validate the account/customer map, billing-site boundaries and freshness.
At the agreed UTC snapshot, find active or non-renewing terms ending
within the next 30 days. Keep scheduled cancellations separate.
Aggregate terms by account and currency. Separately aggregate positive
unpaid invoice balances whose due date is before the snapshot.
Join the aggregates; never repeat an invoice for each subscription.
Return account, upcoming terms, cancellations, overdue invoice IDs,
balance, currency, owner if available, exact bounds and query receipt.
Flag missing due dates, mappings and incomplete coverage. Read only.Return supporting records and the next decision for each account. Display a bounded list while calculating over the complete dataset.
Check coverage before acting on the answer
Use each source's last successful sync as the coverage boundary. A recently collected payment can clear an invoice before a lagging CRM review catches up. Check the current billing record before starting a collection conversation. Subscription-level “total dues” shortcuts may behave differently with consolidated invoicing or customer hierarchies, so this workflow calculates from the invoice dataset.
Combined gives your agent a managed data layer across these sources, so the next question does not require another export. Start with 5 million MAR without a card, connect your apps, and use the Claude Code walkthrough or MCP setup reference.
Sources and further reading
Explore the documentation behind this guide. Product details checked on September 10, 2026.