Got a strange one. I have a UE (beforeload) script...
# suitescript
r
Got a strange one. I have a UE (beforeload) script that I want to override the default
email
On Sales order on CREATE/COPY. • for some reason it won't override the email field • The script is running and I can update the memo field && untick the TO BE EMAIL checkbox as well. • I have done this before so not sure why its not working. Any thoughts on what it could be? • I have got it working via Client script but its not ideal as they will have API creating SO in the future
s
Tried changing the sequence of your script from the Scripted Records page?
r
Yep moved it to the TOP. no WF or any form scripts that seems to be blocking
s
That's a weird one. I suggest to do log and get field value on all entry points. There might or should be something reverting it back
r
yeah I thought so as well. If i fetch the value its already set to the default email. I tried to clear it but it does not clear it as well. Did a client script as as work around but its annoying as hell
a
email on a SO is sourced from customer, yeah?
r
yes default is from customer
a
that sourcing is taking place AFTER your BEFORE load
so its not set yet
r
UE before load : When I log the value is already set to default email
s
Just tested on my end, and it works at the very end of the beforeLoad entry using setValue()
r
Only thing is this customer is on 24.2 already
Untitled.js
a
I'm not entirely sure what this means, but I usually just default to dong this stuff in a client script
r
Yeah that what I ended up doing. but when a SO is created via script these won't run. thus the prefered way in UE before load. But I get the issue with the sourcing
r
Do it in beforeSubmit then ?
r
The customer needs the ability to change it if needed. Thus needs to happen on the before load
r
So do it in both ? Use a pageinit which does whatever job you are trying to do. And if the context is UI then don't run the UE logic.