I want to get the changed fields when the SO is ed...
# suitescript
b
I want to get the changed fields when the SO is edited. However when I get value for 'shipaddress' it always return as changed. I printed and it looks same to me but when I run this command it set changes as true.
Copy code
checkValues = ["shipaddress","billaddress"]
for(var i =0; i<checkValues.length; i++){
                            if(newRec.getValue(checkValues[i]) != oldRec.getValue(checkValues[i])){                             
                                log.debug(`changed values - ${checkValues[i]}`, `${newRec.getValue(checkValues[i])} - ${oldRec.getValue(checkValues[i])}`);
                                changed = true;
                                break;
                            }
}
Any idea please?
a
try using
shippingaddress
and
billingaddress
instead? or using
shipaddresslist
and
billaddresslist
to get the address subrecord id then get all the address fields individually and compare them all independently
b
shippingaddress
and
billingaddress
didn't work
a
hmm you could also just use a regex and remove all the whitespace from the shipaddress/billaddress maybe that will make them equal again?
b
Yes I did it and it works
I removed all spaces using regex and it says they are same
👍 1