does beforeLoad() apply to newly created records?
# suitescript
s
does beforeLoad() apply to newly created records?
nvm it does
s
yep you can differentiation with the
context.type
being
CREATE
on the UserEvent enumeration
🙌 1
s
I think i may be looking at the wrong script type. I think i should be using a Client Script? I'm trying to have the sales rep field autopopulated to whoever is creating a transaction record.
s
Should be able to make that happen with either one, if you want the user to see it happening while they are interacting with record, use client. If the user does not need to be involved and it just happens in the background, stick to UserEvent in my opinion.
To get the id of the user triggering the UserEvent (or the client script for that matter), use
runtime.getCurrentUser()
; you can get more info about what is on there in the help pages.
s
awesome thank you for the feedback