Sample output from the Return-to-Refund Process Mining prompt in the Sonar AI Prompt Library, run against a NetSuite test account. Every name and number here is test data. Back to the post · The library

Return-to-Refund: Object-Centric Process Mining Analysis

NetSuite account TD3016323 (production, OneWorld, USD) · Objects: RtnAuth, ItemRcpt (return receipts), CustCred, CustRfnd, CashRfnd and their originating SalesOrd / CashSale · Scope: all history (first return 2026-08-05) · Prepared 2026-09-04 · Revision 1 · Method: SuiteQL via runSql over transaction, transactionline, nexttransactionlinelink; population small enough for exhaustive listing · Fourth study in the series · Document numbers link to the source record inside NetSuite
  1. 0Executive summary
  2. 1Method and assumptions
  3. 2Event log and structure
  4. 3Process model and variants
  5. 4Cycle time and conformance
  6. 5Credit issued, never refunded
  7. 6Exception registers
  8. 7Data quality
  9. 8Findings and actions
  10. ASuiteQL used
  11. BHand-check

0Executive summary

9
Return-side documents: 4 RMAs · 2 receipts · 3 credit memos · 1 refund · 1 cash refund
1 of 4
RMAs that reached refund — same day
$363.95
Owed to customers with no refund or application
2
RMAs against one sales order (SO4268) — the multi-object case

Returns are new to this account — the first return authorization is dated 2026-08-05 — and all four RMAs belong to one customer, Design Excellence Ltd., each returning a partial quantity from a seven- or five-unit sales order at $51.52 a unit. Small as it is, the population exercises the whole reference path once and breaks it three ways:

  1. The one complete chain closes in zero days. RMA23: SO4266 (2026-08-01) → RMA23 → IR1175 → CM06 → Refund 1, all on 2026-08-05. Authorisation, receipt, credit and refund on the same day, $154.56 to the cent. That is the standard the other three should be measured against.
  2. Goods received, credit never issued. RMA24 (2026-08-16, $103.04): the return was received the same day (IR1178) and has sat in Pending Refund for 19 days with no credit memo. Two further credit memos with no RMA — CM01 $108.48 (Susan Adams) and CM03 $152.43 (Bobby Davis) — are open and unapplied. Total customer money owed with nothing moving: $363.95.
  3. Multi-object structure is real but tiny. SO4268 (7 units) has two RMAs against it — RMA25 for 3 units (pending receipt) and RMA26 for 1 unit (pending approval) — so the order perspective sees a fan-out the RMA perspective does not. All three quantity-bearing RMAs are partial returns (3 of 7, 2 of 5, 3 of 7 + 1 of 7). No RMA spans more than one order, and no RMA links to an invoice: returns here are authorised against the sales order.

Separately, the single cash-sale refund CR01 returns $716.39 against a $241.70 cash sale — a $474.69 over-refund that the link table makes visible in one query.

1Method and assumptions

#AssumptionEffect
A1Objects: RtnAuth, ItemRcpt linked from an RMA, CustCred, CustRfnd, CashRfnd; originating SalesOrd / CashSale included as the root object. Activities: Return Authorised, Received, Credited, Refunded, Cash Refunded.9 return documents + 4 roots.
A2Links = distinct nexttransactionlinelink pairs (SaleRet, ShipRcpt, OrdBill/OrdRvCom, Payment) ∪ transactionline.createdfrom; CostRtrn links excluded (costing, not flow).Both sources agree on every edge.
A3Timestamp = trandate, day resolution; same-day tie-break Authorised < Received < Credited < Refunded.RMA23's chain has cycle 0.
A4Reference model: Return Authorised → Received → Credited → (Refunded | Applied). Credited without RMA is allowed only if applied; open standalone credits are exceptions.1 complete, 3 open prefixes, 3 exceptions.
A5"Owed to customer" = open credit memo foreignpaymentamountunused + RMA total where status is Pending Refund with a receipt and no credit.$260.91 + $103.04.
A6Ages as at 2026-09-04; RMA25, RMA26, CM01, CM03 and CS1072/CR01 are dated on or after 2026-09-02 (future or current).Their ages are ≤ 2 days or negative.

2Event log and structure

DocumentDateStatusAmountQtyInbound linksOutbound links
SO42662026-08-01Billed360.647—RMA23 [SaleRet]
RMA232026-08-05Refunded154.563SO4266 [SaleRet]IR1175 [ShipRcpt] · CM06 [OrdBill, OrdRvCom]
IR11752026-08-05Item Receipt—3RMA23 [ShipRcpt]—
CM062026-08-05Fully Applied154.563RMA23 [OrdBill]Refund 1 [Payment]
Refund 12026-08-05Customer Refund154.56—CM06 [Payment]—
SO42672026-08-15Billed257.605—RMA24 [SaleRet]
RMA242026-08-16Pending Refund103.042SO4267 [SaleRet]IR1178 [ShipRcpt] — no credit memo
IR11782026-08-16Item Receipt—2RMA24 [ShipRcpt]—
SO42682026-09-01Pending Billing360.647—RMA25 [SaleRet] · RMA26 [SaleRet]
RMA252026-09-02Pending Receipt154.563SO4268 [SaleRet]—
RMA262026-09-06Pending Approval51.521SO4268 [SaleRet]—
CS10722026-09-02Cash Sale (Unapproved Payment)241.707—CR01 [SaleRet]
CR012026-09-02Cash Refund716.397CS1072 [SaleRet]—
CM012026-09-14Open108.48—nonenone
CM032026-09-15Open152.43—nonenone
Multiplicity012Note
RMAs per sales order (of orders with any RMA)—21SO4268 → RMA25 + RMA26 (4 of 7 units across two authorisations)
Sales orders per RMA040No RMA spans orders; none links to an invoice
Receipts per RMA220No partial receipts
Credit memos per RMA310RMA24 received but uncredited
Refunds per credit memo210CM01, CM03 open
Return quantity / order quantity3/7 · 2/5 · 3/7 · 1/7Every return is partial
The return flow is many-to-many in principle and nearly one-to-one in practice: one order with two RMAs, everything else a single thread. The interesting structure is not fan-out but stalls — every incomplete case is stopped at a different step.

3Process model and variants

Figure 1 — Directly-follows graph, all return cases. Emerald = the complete path (RMA23); grey = open prefixes and exceptions. Labels: count.

#VariantCasesCycleCase
1Sold → Return Authorised → Received → Credited → Refunded14 d from sale · 0 d from RMASO4266 08-01 → RMA23 08-05 → IR1175 → CM06 → Refund 1 (all 08-05)
2Sold → Return Authorised → Received (stalled)119 d and countingSO4267 08-15 → RMA24 08-16 → IR1178 08-16 → …
3Sold → Return Authorised (awaiting receipt)12 dSO4268 09-01 → RMA25 09-02
4Sold → Return Authorised (awaiting approval)1futureSO4268 09-01 → RMA26 09-06
5Cash Sold → Cash Refunded10 dCS1072 09-02 → CR01 09-02 (amount mismatch)
6Credited (only)2—CM01 09-14 · CM03 09-15

4Cycle time and conformance

TransitionObservedDaysNote
Sold → Return Authorised44 · 1 · 1 · 5Returns are raised within a week of sale
Return Authorised → Received20 · 0Goods arrive the day the RMA is raised
Received → Credited10RMA24 has waited 19 days for this step
Credited → Refunded10
Cash Sold → Cash Refunded10
Conformance outcomeCasesCases
Complete and conforming1RMA23
Conforming open prefix2RMA25 (awaiting receipt, 2 d) · RMA26 (awaiting approval, future-dated)
Stalled — received, not credited1RMA24 (19 d)
Exception — credit without RMA, unapplied2CM01 · CM03
Exception — refund exceeds sale1CR01 $716.39 vs CS1072 $241.70

5Credit issued, never refunded — the actionable cohort

DocumentCustomerDateOwedAge dStopped atNext action
RMA24 + IR1178Design Excellence Ltd.2026-08-16103.0419Received, no credit memoIssue credit memo from RMA24, then refund
CM03Bobby Davis2026-09-15152.43−11Credit open, unapplied, no RMAApply to an open invoice or refund
CM01Susan Adams2026-09-14108.48−10Credit open, unapplied, no RMAApply or refund (Susan Adams also has an unapplied $934.78 payment — see the Cash Application study)
3 customers363.95100% of return-side liability is stalled; 0% is in dispute

6Exception registers

6-A · Open return authorisations (3)

RMADateStatusCustomerQtyAmountOriginAge dMemo
RMA242026-08-16Pending RefundDesign Excellence Ltd.2103.04SO426719DIG - O2C
RMA252026-09-02Pending ReceiptDesign Excellence Ltd.3154.56SO42682DIG - O2C
RMA262026-09-06Pending ApprovalDesign Excellence Ltd.151.52SO4268−2DIG - O2C

6-B · Amount anomaly (1)

RefundDateCustomerRefundOriginal saleExcessMemo
CR012026-09-02Jane Jackson716.39241.70 (CS1072, 7 units, status "Unapproved Payment")474.69POS refund of CashSale 42234

The cash sale's payment is itself unapproved. A refund of 3× the sale value against an unapproved sale is either a data-load artefact or a control gap; either way it is the single largest return-side figure in the account.

7Data quality

LimitationEvidenceEffect
Population of one customerAll 4 RMAs are Design Excellence Ltd. with "DIG - R2C / O2C" memosDemonstration scenarios; cycle-time statistics are anecdotes, not distributions
Day resolutionRMA23's four steps share one dateIntra-day ordering by assumed rank (A3)
Future-dated documentsRMA26, CM01, CM03 dated after 2026-09-04Negative ages
Return receipts carry no statusIR1175, IR1178 status "Undefined"Inspection / disposition (restock vs scrap) unobservable
No RMA links to an invoiceAll SaleRet links are SalesOrd → RtnAuth"One RMA against several invoices" cannot occur in this configuration

8Findings and recommended actions

  1. Clear the $363.95 stalled cohort today. Create the credit memo for RMA24 (received 19 days ago), apply or refund CM01 and CM03. Then add a saved search — RMAs in Pending Refund with a linked receipt and no credit memo; credit memos open more than 7 days — to the AR dashboard so the stall is visible the day it happens.
  2. Investigate CR01. A $716.39 refund against a $241.70 unapproved cash sale. Confirm whether the refund amount is a load error; if not, establish who authorised a refund at three times sale value.
  3. Keep the RMA23 standard. Authorise, receive, credit and refund in one day is achievable — it happened. Measure every future return against it; when volume grows, the same queries in Appendix A produce the distribution.

AAppendix A — SuiteQL used

Q1 — Census with live status labels

SELECT x.type, x.status, x.docs, BUILTIN.DF(t.status) AS label, x.first_date, x.last_date, x.total
FROM (SELECT type, status, COUNT(*) AS docs, MIN(id) AS sample_id, TO_CHAR(MIN(trandate),'YYYY-MM-DD') AS first_date,
             TO_CHAR(MAX(trandate),'YYYY-MM-DD') AS last_date, ROUND(SUM(ABS(foreigntotal)),2) AS total
      FROM transaction WHERE type IN ('RtnAuth','CustCred','CustRfnd','CashRfnd') GROUP BY type, status) x
JOIN transaction t ON t.id = x.sample_id ORDER BY x.type, x.docs DESC

Q2 — Link-type census

SELECT p.type AS prev_type, n.type AS next_type, l.linktype, COUNT(*) AS link_rows, COUNT(DISTINCT l.previousdoc || '-' || l.nextdoc) AS pairs
FROM nexttransactionlinelink l JOIN transaction p ON p.id = l.previousdoc JOIN transaction n ON n.id = l.nextdoc
WHERE p.type IN ('RtnAuth','CustCred','CustRfnd','CashRfnd') OR n.type IN ('RtnAuth','CustCred','CustRfnd','CashRfnd')
GROUP BY p.type, n.type, l.linktype ORDER BY COUNT(*) DESC

Q3 — Every return document with inbound / outbound links

SELECT t.id, t.type, t.tranid, TO_CHAR(t.trandate,'YYYY-MM-DD') AS trandate, BUILTIN.DF(t.status) AS status_label, BUILTIN.DF(t.entity) AS customer,
       ROUND(ABS(t.foreigntotal),2) AS total, ROUND(t.foreignpaymentamountunused,2) AS unused, t.memo,
       (SELECT LISTAGG(p.type || ' ' || p.tranid || ' [' || l.linktype || ']', '; ') WITHIN GROUP (ORDER BY p.trandate)
          FROM nexttransactionlinelink l JOIN transaction p ON p.id = l.previousdoc WHERE l.nextdoc = t.id AND l.linktype <> 'CostRtrn') AS inbound,
       (SELECT LISTAGG(n.type || ' ' || n.tranid || ' [' || l.linktype || ']', '; ') WITHIN GROUP (ORDER BY n.trandate)
          FROM nexttransactionlinelink l JOIN transaction n ON n.id = l.nextdoc WHERE l.previousdoc = t.id AND l.linktype <> 'CostRtrn') AS outbound,
       (SELECT MAX(tl.createdfrom) FROM transactionline tl WHERE tl.transaction = t.id AND tl.mainline='T') AS createdfrom
FROM transaction t WHERE t.type IN ('RtnAuth','CustCred','CustRfnd','CashRfnd') ORDER BY t.trandate, t.id

Q4 — Quantities on RMAs, receipts and originating orders

SELECT t.type, t.tranid, TO_CHAR(t.trandate,'YYYY-MM-DD') AS trandate, BUILTIN.DF(t.status) AS status_label, ROUND(ABS(t.foreigntotal),2) AS total,
       (SELECT COUNT(*) FROM transactionline tl WHERE tl.transaction=t.id AND tl.mainline='F' AND tl.taxline='F') AS lines,
       (SELECT SUM(ABS(tl.quantity)) FROM transactionline tl WHERE tl.transaction=t.id AND tl.mainline='F' AND tl.taxline='F') AS qty,
       (SELECT SUM(NVL(tl.quantityshiprecv,0)) FROM transactionline tl WHERE tl.transaction=t.id AND tl.mainline='F' AND tl.taxline='F') AS qty_recv_or_shipped
FROM transaction t WHERE t.id IN (40200,40303,40304,42234) OR t.tranid IN ('IR1175','IR1178') OR t.type = 'RtnAuth' ORDER BY t.trandate, t.id

BAppendix B — Hand-check

RMA23 $154.56 = 3 units × $51.52 ✓ · CM06 $154.56 = RMA23 ✓ · Refund 1 $154.56 = CM06 ✓ · RMA24 $103.04 = 2 × 51.52 ✓ · RMA25 + RMA26 = 3 + 1 = 4 of 7 units on SO4268; $154.56 + $51.52 = $206.08 ✓ · Owed = 103.04 + 108.48 + 152.43 = $363.95 ✓ · CR01 excess = 716.39 − 241.70 = $474.69 ✓ · Documents: 4 + 2 + 3 + 1 + 1 = 11 return-side incl. receipts; 9 excluding receipts ✓.