how to read the debit and credit of standard gl li...
# ask-stanley-ai
n
how to read the debit and credit of standard gl lines in custom plugin suitescript 2.0
c
AI generated answer (using internal Slack threads):
To read the debit and credit of standard GL lines in a custom plugin using SuiteScript 2.0, you would need to use the
getCurrentSublistValue
method of the
N/record
module. However, it's important to note that the standard GL lines are read-only in a GL plugin, meaning you can't modify them directly. Here's a basic example of how you might read the debit and credit values:
Copy code
javascript
var record = require('N/record');
var transaction = record.load({
    type: record.Type.INVOICE, 
    id: 'your_invoice_id'
});

var lineCount = transaction.getLineCount({sublistId: 'line'});
for (var i = 0; i < lineCount; i++) {
    var debit = transaction.getSublistValue({
        sublistId: 'line',
        fieldId: 'debit',
        line: i
    });
    var credit = transaction.getSublistValue({
        sublistId: 'line',
        fieldId: 'credit',
        line: i
    });
    // Do something with debit and credit values
}
Remember, this is just a basic example. You'll need to adjust it to fit your specific needs. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830014944
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829212427
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828189611
Please provide your feedback on this answer.