Hello! I have this Custom GL Line that manipulates...
# suitescript
s
Hello! I have this Custom GL Line that manipulates the Customer Deposit GL upon creation. This will debit the Customer Deposit account in GL Impact and Credit to the Deferred Revenue account. This is the process for us to tag the impact into Deferred Revenue instead of going into Customer Deposits. However, we've noticed that this Custom GL Plugin causes duplicate lines under "Deposit" sublist on Customer Payment and Customer Refund. They have the same internal IDs when clicking on date. Does anyone know why?
Here's the Custom GL Line script:
Copy code
function customizeGlImpact(transactionRecord, standardLines, customLines, book) {
    var currLine = standardLines.getLine(0);
    var entityId = currLine.getEntityId();

    var recordType = transactionRecord.getRecordType();
    
    if(recordType == 'customerdeposit') {
        var gl_custdep = customLines.addNewLine();
        gl_custdep.setDebitAmount(standardLines.getLine(1).getCreditAmount());
        gl_custdep.setAccountId(standardLines.getLine(1).getAccountId());
        gl_custdep.setEntityId(entityId);
        gl_custdep.setMemo("Custom GL going to Deferred Revenue");

        var gl_defrev = customLines.addNewLine();
        gl_defrev.setCreditAmount(standardLines.getLine(1).getCreditAmount()); 
        gl_defrev.setAccountId(1283);
        gl_defrev.setEntityId(entityId);
        gl_defrev.setMemo("Custom GL going to Deferred Revenue");
z
You have one transaction but two GL impacts for the same customer. When you create customer payment, you will get ALL GL impacts where the same customer and A/R account are linked.
s
Thank you @Zoran R-DATAGRAM. So basically the Deposit sublist is fetching Customer Deposit list based on GL Impact of "Customer Deposit" account?
z
I would say that, but take it without guarantee, I am not NS functional consultant. It is from my experience. You should check it with more examples and tests.
s
No worries! Appreciate your help on this! @Zoran R-DATAGRAM