I am getting the billing address value from a Suit...
# suitescript
m
I am getting the billing address value from a Suitelet and comparing the value with the billing address on a sales order. My sample Suitelet and Sales Order has identical values, but the evaluation returns false. I've tried removing white spaces using trim and also normalize to turn the string into a standardized form. I can see the length of both fields are different slightly. Anything I can try?
Copy code
const _customerBillingAddress = customerBillingAddress.normalize().trim();
                    log.debug({
                        title: "_customerBillingAddress", details: _customerBillingAddress
                    });
                    const _salesOrderBillingAddress = salesOrderBillingAddress.normalize().trim();
                    log.debug({
                        title: "_salesOrderBillingAddress", details: _salesOrderBillingAddress
                    });

                    log.debug({
                        title: "cb length", details: _customerBillingAddress.length
                    });

                    log.debug({
                        title: "sb length", details: _salesOrderBillingAddress.length
                    });

                    if (_customerBillingAddress === _salesOrderBillingAddress) {
                        log.debug("EQUAL, end!")
                    } else {
                        SALESORDER.setValue({
                            fieldId: 'billaddress',
                            value: customerBillingAddress
                        });
                    }
b
the guess would be that the new line characters dont match
👍 1
use charAt on each character to see which ones are different
👍 1