Hi, via a UserEventScript afterSubmit() the follow...
# suitescript
g
Hi, via a UserEventScript afterSubmit() the following code is erroring out with 'TypeError: context.newRecord.selectLine is not a function'. Does this only work via a ClientSideScript, or is there something I'm missing?
context.newRecord.selectLine({
sublistId: 'item',
line:     i,
});
b
selecting lines is done with records that are using dynamic mode
the newRecord in a user event script is not in dynamic mode
👍 1
g
Oh right! Will that mean record.load() in dynamic within a user event script would work?
b
depends on how well you know user event scripts
general answer is that loading a record in dynamic mode will work, but is not desirable
💯 1
trying to load and save the current record is a terrible idea in beforeLoad and beforeSubmit entry points
💯 1
and is terrible for performance in afterSubmit scripts
💯 1
g
Ah right, yeah, was going for afterSubmit. Would a client side script be more suitable for this then?
b
i dont know what you are trying to do
by default, trying to modify the newRecord in an afterSubmit entry point doesnt work at all
g
Update line items rate field, based on a field value on the item record.
b
that sounds like something you should do in a client script if possible
g
Cool as 🙂
b
its very unfriendly for a person to submit a transaction with amounts looking one way and it coming back another
g
So true.
b
its also not something to do in an after submit entry point, that doesnt sound like something that needs to double the save time of a record
g
I'll revise this, cheers for your input
Thanks for letting me know