I'm doing this afterSubmit
# suitescript
c
I'm doing this afterSubmit
j
I would have thought you'd need to populate these values beforeSubmit rather than after. But the way I've done this before is using the
Record.getSublistSubrecord(options)
function.
c
@jmacdonald there isn't a sublist to get at this point
the record was only created a few lines prior in the script
then I'm creating the first line item, then I need to create an INVENTORY_DETAIL subRecord and attach it to the line
j
do you create the line items in the afterSubmit function? I don't get what you're saying
you create the line, populate details, then after committing the line you can use the function I mentioned above to set the subrecord details
c
I did it as you said - that seemed like the most logical way to me
but I can see that's not the right way to do it when I look at the debugger - there is no subrecord so setting the fields fails
I need to create the subrecord on the line first
j
Calling getSublistSubrecord creates the subrecord.
c
Well that's an interesting naming convention 😄