RE: Deleted Record and Transaction Numbering Audit Log

Has anyone managed to link the Deleted Record and Transaction Numbering Audit Log tables in SuiteQL so that you can return the reasons for deleted records?

This will return deleted Invoices from last year:


SELECT

DeletedRecord.DeletedDate,

DeletedRecord.Type,

DeletedRecord.RecordID,

DeletedRecord.DeletedBy,

DeletedRecord.Context

FROM

DeletedRecord

WHERE

( DeletedRecord.DeletedDate >= TO_DATE ( '2024-01-01', 'YYYY-MM-DD' ) )

AND ( DeletedRecord.DeletedDate <= TO_DATE ( '2024-12-31', 'YYYY-MM-DD' ) )

AND ( DeletedRecord.Type = 'INVOICE')

And this will return the Reasons:


SELECT

TransactionNumberingAuditLog.dateDeleted,

TransactionNumberingAuditLog.deletedBy,

BUILTIN.DF( TransactionNumberingAuditLog.transactionDeletionReason ) AS Reason,

TransactionNumberingAuditLog.deletionReasonMemo,

TransactionNumberingAuditLog.deletionReasonOrigin,

TransactionNumberingAuditLog.transaction,

TransactionNumberingAuditLog.tranNumber,

TransactionNumberingAuditLog.tranType

FROM

TransactionNumberingAuditLog

WHERE

( TransactionNumberingAuditLog.dateDeleted >= TO_DATE ( '2024-01-01', 'YYYY-MM-DD' ) )

AND ( TransactionNumberingAuditLog.dateDeleted <= TO_DATE ( '2024-12-31', 'YYYY-MM-DD' ) )

AND ( TransactionNumberingAuditLog.tranType = 'CustInvc')

Both return the correct results:

RE: Deleted Record and Transaction Numbering Audit Log

RE: Deleted Record and Transaction Numbering Audit Log

But the transaction ID field is NULL in the Audit log. I have the TRANNUMBER field, but I don’t have that in the Deleted Record table.

Is there any way to do a SQL JOIN on the date created fields? I know there is a risk I might not get the correct link, but for this use case (deleted Invoices for our annual audit) I think that risk is very low.

I did try a couple of permutations of date linking, but failed to get a working script. I’m vaguely familiar with SQL joins, but it’s been a while since I used them, so it may just be my formatting is wrong.

If any can suggest a script that will allow me to link these two tables, I would be very grateful.

Add Comment
2 Answers

When a record gets deleted in NetSuite, its transaction number won’t be reused, and you can find details – including who deleted it and when – using System Notes or the Audit Trail logs.

Rookie Answered on July 22, 2025.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.