๐งฉ Custom GL Plug-in Part 2 โ Real Audit and Compliance Reporting Examples
Introduction
In regulated accounting environments, transparency is everything.
The Custom GL Lines Plug-in allows organizations to control how transactions hit the general ledger โ but auditors also need to see why and how those entries were generated.
In this tutorial, youโll learn how to:
โ
Create auditable GL adjustments.
โ
Generate reconciliation reports for auditors.
โ
Use custom records to log plug-in activity.
โ
Apply allocation logic for compliance and traceability.
๐ก Why Audit Visibility Matters
Objective | Example |
---|---|
Compliance | SOX / IFRS reporting requires traceable entries |
Accuracy | Split revenue by project or region |
Transparency | Show why a GL line was added |
Audit Trail | Record who and which script generated entries |
โ๏ธ Design Pattern Overview
- Custom GL Plug-in adds extra lines.
- Custom Record logs each adjustment (
custrecord_gl_audit_log
). - Saved Search / SuiteAnalytics Workbook aggregates entries for auditors.
๐งฑ Step 1: Extend the Custom GL Plug-in
/**
* @NApiVersion 2.1
* @NScriptType CustomGLPlugin
*/
define(['N/record','N/log'], (record, log) => {
function customizeGlImpact(context) {
try {
const rec = context.transactionRecord;
const total = rec.getValue('total');
const dept = rec.getValue('department');
if (total > 5000) {
const newLine = context.customLines.addNewLine();
newLine.setAccountId(2345); // Audit adjustment account
newLine.setDebitAmount(25);
newLine.setMemo('Compliance Adjustment Fee');
// Log to custom audit record
const audit = record.create({ type: 'customrecord_gl_audit_log' });
audit.setValue('custrecord_source_tran', rec.id);
audit.setValue('custrecord_adjustment_amount', 25);
audit.setValue('custrecord_created_by', runtime.getCurrentUser().id);
audit.save();
}
} catch (e) { log.error('Audit Plug-in Error', e); }
}
return { customizeGlImpact };
});
โ Result: Each time a qualifying transaction posts, a GL adjustment line is added and a matching audit record is stored.
๐งฎ Step 2: Create Audit Log Custom Record
Field | ID | Type |
---|---|---|
Source Transaction | custrecord_source_tran | List/Record (Transactions) |
Adjustment Amount | custrecord_adjustment_amount | Currency |
Created By | custrecord_created_by | Employee |
Timestamp | custrecord_created_on | Date/Time (Auto) |
Status | custrecord_audit_status | List (Pending, Posted, Reviewed) |
Add permissions so only Accounting and Auditors can view or edit these records.
๐ Step 3: Create Audit Reports and Searches
Saved Search: Custom GL Adjustments โ Audit Trail
- Type: Custom Record > GL Audit Log
- Columns: Transaction, Account, Amount, Created By, Date
- Filter:
Created Date within this fiscal period
- Highlight abnormal entries (> threshold).
Example Formula Column: CASE WHEN {custrecord_adjustment_amount} > 1000 THEN 'โ Review' ELSE 'OK' END
๐ Step 4: Generate Audit Reports via SuiteAnalytics Workbook
- Create Dataset โ Base = Custom GL Audit Log.
- Join to Transaction and Employee.
- Add Pivot: Amount by Department / Month.
- Add Chart: Bar Graph of Adjustment Totals by User.
๐ Result: Auditors see summary of who posted manual GL adjustments and why.
๐ Step 5: Integrate with Approval Workflow (Optional)
For compliance, you can require CFO approval before posting manual entries.
Workflow Condition: If Amount > 1000 โ Set Status = Pending CFO Review
Add buttons โApproveโ and โRejectโ on the Custom Record form.
๐ง Advanced Audit Use Cases
Use Case | Description |
---|---|
Revenue Split Audit | Track allocation of revenue between multiple departments automatically. |
Tax Adjustment Tracking | Log custom tax GL entries for VAT/GST reconciliation. |
Intercompany Allocations | Generate balancing entries across subsidiaries. |
Deferred Revenue Compliance | Create GL adjustments for ASC 606 rules and log details. |
๐ Example: Intercompany Allocation Plug-in Logic
if (subsidiaryA !== subsidiaryB) {
const intercoLine = context.customLines.addNewLine();
intercoLine.setAccountId(5678);
intercoLine.setCreditAmount(100);
intercoLine.setMemo('Intercompany Adjustment');
logAudit(subsidiaryA, subsidiaryB, 100);
}
This records both the GL entry and a matching audit log entry for financial review.
๐งพ Step 6: Exporting Audit Data for External Review
- Use CSV Export or SuiteAnalytics Workbook to share audit trail with auditors.
- Create role External Auditor (Read-Only) with access only to Audit Records and GL Reports.
- Schedule export monthly via SuiteAnalytics Scheduled Workbook Email.
โก Common Audit Mistakes and Fixes
Problem | Root Cause | Fix |
---|---|---|
No trace of manual GL line | Plug-in adds line but no record logged | Create custom record per entry |
Audit report incomplete | Filters exclude inactive users | Include All Employees in search |
Auditor canโt see logs | Permission issue | Assign โViewโ access to role |
Incorrect account IDs | Hardcoded IDs mismatch across env | Use script parameter or lookup table |
๐งฉ Security Best Practices
โ
Store Audit Data in Custom Records, not transaction memos.
โ
Restrict access to Accounting and Auditors roles only.
โ
Encrypt sensitive references (if PII exists).
โ
Never allow users to edit audit records after posting.
โ
Enable System Notes v2 for change tracking.
๐ Related Tutorials
- ๐ Custom GL Lines Plug-in (Part 1)
- ๐ SuiteScript Security & Governance Best Practices
- ๐ Advanced Approval Workflows in NetSuite
โ FAQ
Q1. Can auditors view GL impact directly in NetSuite?
Yes โ if they have the โGeneral Ledger Viewโ permission and access to Audit Records.
Q2. Can Custom GL Plug-ins affect system posting order?
No โ they run after standard GL impact is created but before posting.
Q3. Can I build a dashboard to monitor audit entries?
Yes โ create a Custom Portlet that shows recent audit adjustments or total adjustments per month.
Q4. Is there a limit to number of audit entries?
No practical limit โ but archive old records annually for performance.
๐งญ Summary
The Custom GL Plug-in is not just about automation โ itโs a foundation for audit readiness and transparency.
By logging every GL impact and building analytics around it, your NetSuite system can produce traceable, compliant, and easily auditable financial data.
This approach transforms your accounting customization into a governance-aligned, CFO-approved solution โ ready for real-world enterprise audits.
Leave a Reply