Hi all! I want to do some verification to the reco...
# suitescript
m
Hi all! I want to do some verification to the record in UE Before Submit and then if there is something wrong I will show a message to the user and ask them to correct those things. And naturally not to save the record yet. So what would be the best way to do this kind of message? [Edit: Before Load -> Before Submit]
b
beforeLoad would not be the usual place to do input verification. Primarily because it happens before a user inputs data.
m
Sorry my mistake, I meant Before Submit!
p
You probably want to use a clientscript to do initial validation so that you don’t lose all changes. It’s a bit of a trade-off with user experience if you do it purely in a UE
Though this is one of those things where people have different opinions on the direction to take
b
If you only want the validation to occur for the user interface, client script saveRecord is usually the way to go
use the currentRecord from the scriptContext to get your fields to validate them, and then use something like alert or N/ui/dialog, or whatever 3rd party module you like.
m
The thing is that I need to compare the new record to some other record (its parent). So can I do such thing in clientscript?
p
Yes. Just load the other record
b
its very similar, only major difference is how you access the newRecord, which is called currentRecord during saveRecord. The currentRecord.CurrentRecord api is very similar to a record.Record
m
Thanks guys! I think it works now 🙂