Statistical Journal Entry

The statistical journal entry record lets you increase or reduce the balance of a statistical account.

To use this record, the Statistical Accounts feature must be enabled at Setup > Enable Features, on the Accounting subtab. Also, you must have already created at least one statistical account. In the UI, you access this record at Transactions > Financial > Make Statistical Journal Entries.

For help working with this record in the UI, see Making Statistical Journal Entries.

This internal ID for this record is statisticaljournalentry.

See the SuiteScript Records Browser for all internal IDs associated with this record.

Note:

For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

For information about scripting with this record in SuiteScript, see the following help topics:

Supported Script Types

The statistical journal entry record is scriptable in both client and server SuiteScript.

All three user events are supported: beforeLoad, beforeSubmit, and afterSubmit.

Supported Functions

The statistical journal entry record is fully scriptable, which means that the record can be created, updated, copied, deleted, and searched using SuiteScript.

Usage Notes

Be aware of the following:

Code Samples

The following samples show how you can script to the statistical journal entry record.

Adding and Deleting

The following sample shows how you can create the record, add lines, load the record, and delete it.

          // Note: These samples use constants (defined like: var subsidiaryId = '1') which are not included here.

// Create Record
var statisticalJournal = record.create({
    type: record.Type.STATISTICAL_JOURNAL_ENTRY
});
statisticalJournal.setValue({
    fieldId: 'subsidiary',
    value: subsidiaryId
});
statisticalJournal.setValue({
    fieldId: 'externalid',
    value: externalId
});
statisticalJournal.setValue({
    fieldId: 'unitstype',
    value: unitsTypeId
});
statisticalJournal.setValue({
    fieldId: 'unit',
    value: unitId
});

// Add line to the record
statisticalJournal.setSublistValue({
    sublistId: 'line',
    fieldId: 'account',
    line: 1,
    value: statisticalAccountId
});
statisticalJournal.setSublistValue({
    sublistId: 'line',
    fieldId: 'debit',              // field 'debit' has label 'Amount' in UI
    line: 1,
    value: amount
});
statisticalJournal.setSublistValue({
    sublistId: 'line',
    fieldId: 'lineunit',
    line: 1,
    value: unitId
});       
statisticalJournal.setSublistValue({
    sublistId: 'line',
    fieldId: 'memo',
    line: 1,
    value: memo
});
 
statisticalJournal.setSublistValue({
    sublistId: 'line',
    fieldId: 'class',
    line: 1,
    value: classId
});
statisticalJournal.setSublistValue({
    sublistId: 'line',
    fieldId: 'department',
    line: 1,
    value: departmentId
});
statisticalJournal.setSublistValue({
    sublistId: 'line',
    fieldId: 'location',
    line: 1,
    value: locationId}
);

// Add record
var recId = statisticalJournal.save();

// Load record
var statisticalJournalAddedRec = record.load({
    type: record.Type.STATISTICAL_JOURNAL_ENTRY,
    id: recId
});

// Delete record
var deleteId = record.delete({
    type: record.Type.STATISTICAL_JOURNAL_ENTRY,
    id: recId
}); 

        

Updating the Subsidiary Field

The following sample shows how to update the subsidiary field, which and only be done in dynamic mode.

          var recType = record.Type.STATISTICAL_JOURNAL_ENTRY;

// 1st: Load record in Dynamic Mode
var journalEntry = record.load({
    type: recType,
    id: '168',
    isDynamic: true
});

// 2nd: Remove all lines
var lineCount = journalEntry.getLineCount({
    sublistId: 'line'
});
for (i = 1; i <= lineCount; i++){
    var removeId = journalEntry.removeLine({
        sublistId: 'line',
        line: i
    });
}

// 3rd: Change subsidiary
journalEntry.setValue({
    fieldId: 'subsidiary',
    value: '6'
});

// 4th: Add new line for changed subsidiary
// The new account must be available in the new subsidiary
journalEntry.selectNewLine({
    sublistId: 'line'
});
journalEntry.setCurrentSublistValue({
    sublistId: 'line',
    fieldId: 'account',
    value: '286'
});
journalEntry.setCurrentSublistValue({
    sublistId: 'line',
    fieldId: 'debit',
    value: '5'
});
journalEntry.commitLine({
    sublistId: 'line'
});

var recId = journalEntry.save(); 

        

Related Topics

General Notices