I'm trying my hand at a 2.0 restlet. This is more or less my first experience with SuiteScript 2.0. I'm trying to create a vendorpayment record. I've been able to create a vendor record without an issue, but when I try with vendorpayment, I get an error that says, "You must enter at least one line item for this transaction", which seems to make sense. That's where I'm stuck though. I can't seem to create that sublist item in 2.0.
I've tried a few things, but basically I'm creating a record like this (type, isDynamic and defaultValues are parameters in this function. isDynamic is false):
var rec = record.create({
type: type,
isDynamic: isDynamic,
defaultValues: defaultValues
});
How do I then use 'rec' to add a transaction? I'm assuming it goes to the 'apply' sublist, so I've tried a few things similar to
rec.selectLine('apply', 0);
rec.setSublistValue({'sublistId': 'apply', 'fieldId': 'doc', 'value': 'blah', 'line': 0});
but I get an error that says, "Cannot find function selectLine in object DeferredDynamicRecord". I've tried various other snippets as well, but no love. I'm not sure if I'm going about it the right way. Thanks in advance.