Alternatively, has anyone managed to create deposi...
# suitescript
k
Alternatively, has anyone managed to create deposits in 2.0?
b
I recommend looking up the record in the SuiteScript Supported Records page
it lists how to create deposits and how to set the default values for the transactions being deposited against, which is how you ensure it will work when the number of deposits exceeds the maximum sublist length
Copy code
require(['N/record'], function(record) {
  var myDeposit = record.create({
    type: record.Type.DEPOSIT,
    isDynamic: true,
    defaultValues: {
      deposits: '123456'
    }
  });

  myDeposit.selectLine({ line: 0, sublistId: 'payment' });
  myDeposit.setCurrentSublistValue({
    fieldId: 'deposit',
    value: true,
    sublistId: 'payment'
  });
  myDeposit.commitLine({ sublistId: 'payment' });

  myDeposit.save();
});