To add the reversed transaction lines along with the existing lines

Scenario: While doing a CSV import process, the client needs to add an extra reversed line along with the existing lines. To meet this requirement, we have developed a new User Event script that inserts these additional lines. The User Event is deployed to the Journal entry with the ‘EXECUTION CONTEXT’ set as ‘CSV import.’ This script will run after the record is submitted, and the relevant code section will be written within the ‘afterSubmit’ entry point.”

 let lineCount = newTransactionRecord.getLineCount({ sublistId: 'line' });
                            log.debug("lineCount", lineCount);

for (let i = 0; i < lineCount; i++) {

 let accountId = newTransactionRecord.getSublistValue({ sublistId: 'line', fieldId: 'account', line: i });
 subsidiaryAccounts.push(accountId);

let statementNotes = newTransactionRecord.getSublistValue({ sublistId: 'line', fieldId: 'custcol_grant_note', line: i });
statementNote.push(statementNotes)

 let debit = newTransactionRecord.getSublistValue({ sublistId: 'line', fieldId: 'debit', line: i });
 currentDebit.push(debit);

let credit = newTransactionRecord.getSublistValue({ sublistId: 'line', fieldId: 'credit', line: i });
currentCredit.push(credit);

}

let subsidiaryAccountsReversed = subsidiaryAccounts.concat(subsidiaryAccounts.slice().reverse());
let statementNoteReversd = statementNote.concat(statementNote);
let debitReversed = currentDebit.concat(currentCredit.slice().reverse());
let creditReversed = currentCredit.concat(currentDebit.slice().reverse());

Leave a comment

Your email address will not be published. Required fields are marked *