I want to remove / replace line items based on wha...
# suitescript
c
I want to remove / replace line items based on what's in the items list as soon as the record loads so the user can see the changes before saving the record
s
Wouldn't it make more sense to change on save in a beforeSubmit when it was saved originally than trying to modify when the record is being accessed? But yes, you are correct, pageInit client is probably the way to go.
c
@Sandii This is a new record - I thought beforeSubmit doesn't let the user see the changes until you press the save button - that's a bad user experience
s
I think I misread what you wanted it to do then.
c
The vendor bill takes the line items from the PO but I need to substitute some items on the bill as soon as the 'bill' button is pressed
I'm thinking pageInit is the best way to do that
maybe my use of the word load is not correct - I'm not sure what other word to use
s
Yeah I was thinking you were loading and accessing record, yes I agree pageInit is the best way to do it. The main issue is you are losing context, so you need to figure out how to limit the scope maybe to only affect people that are there because they hit that button?
c
Yeah - without accessing the context.UserEventType what can I do?
scriptContext.mode should do the trick?
Copy code
if (context.mode !== 'create')
    return;