``` if (sublistid == tranid) { deposi...
# suitescript
n
Copy code
if (sublistid == tranid) {
        deposit.setSublistValue({
          sublistId: 'payment',
          fieldId: 'deposit',
          line: i,
          value: true
        });
        log.debug('Deposit line set true', i);
Trying to set the deposit checkbox to "true" if the sublist transaction = the transaction id I have... this code seems to be able to identify the sublist id == tranid but doesn't set the value.. am I missing a commit or something?
z
deposit.commitLine()
n
ah, so I do have to commitLine even with the setSublistValue
z
yes, and if it is outside of UI form (just script) you should call deposit.save() Just imagine : commitLine is submit line as you press OK/ADD button on the form. If you click cancel button on the DEPOSIT form, all changes are reverted. So,. if your code is executing in client script events, you should NOT call deposit.save(), it will be executed when user click SAVE button
n
i am calling deposit.save(); later in my code -> when you create a deposit record you just check off the transactions that are available so there is no "add" on the line
z
ahh yes, yes... it is "applied to" sublist, right?
n
basically yes
z
I've checked my code. I have similar situation when scripting Customer payment and need to correct amount in sublist with Invoices.. Sometimes it more than total amount of payment. I don't see commitline here?!? Just setCurrentSublistValue(), there is no commitLine 😢... I guess that is not regular sublist, and only paymemt.save() is executed, evertthing works fine... Unfortunately, I'm canceling my comments I sent to you..
n
no worries, that is what I thought ... maybe I just need to run a couple more tests?
z
How do you create deposit object? Is it record.load() or it is currentRecord from client script?
n
record.load()
MRS script
i load the record, loop through the sublist 'payment' then if the sublistid == tranid I want to check off the box to deposit it
z
clear.. and you have deoosit.load() in map/reduce or somewhere else?
n
in MRS itself
z
MRS = map reduce script?
Doesn't matter, I would check in record.load() is there option: isDynamic : true
n
yes its map reduce
ok I will take a look -> I need to put my record to dynamic?
z
i would try with dynamic