Here you have a sample function to compare fields ...
# suitescript
a
Here you have a sample function to compare fields from old and new record that I actively use...