Mapping Shipping and Billing Adress Street 1 & 2 on Orders from Salesforce to NetSuite
I wanted to pass on some work/correction I did in my Salesforce / NetSuite IO IA to map Shipping & Billing Address correctly on SF Orders to NS Sales Orders.
The IA only provides the intermediate fields "ShippingAddress1 / ShippingAddress2 / BillingAddress1 / BillingAddress2" On Contacts and Accounts SF -> NS flows.
This is noted on https://docs.celigo.com/hc/en-us/articles/360039704672-Map-address-between-Salesforce-and-NetSuite but is easy to miss.
Unfortunately this exceptionally helpful mapping is missing from Orders.
I wanted to provide a work around for those in the same position I was in (without doing some lifting in Salesforce). You can use regexReplace handlebars to break up the Salesforce values in a similar fashion.
The following multi-field mappings should be valuable to you.
For NS Sales Order Billing Address 1
{{#if BillingStreet}}{{regexReplace BillingStreet "" "[\r\n][\s\S]*" "g"}}{{/if}}
For NS Sales Order Billing Address 2
{{#if BillingStreet}}{{regexReplace BillingStreet "" "^.*[\r\n]*\s*"}}{{/if}}
For NS Sales Order Shipping Address 1
{{#if ShippingStreet}}{{regexReplace ShippingStreet "" "[\r\n][\s\S]*" "g"}}{{/if}}
For NS Sales Order Shipping Address 2
{{#if ShippingStreet}}{{regexReplace ShippingStreet "" "^.*[\r\n]*\s*"}}{{/if}}
Hopefully this will save you the time I lost. Celigo, you should provide the same breakdown that is available on Contact/Account from Salesforce to the Order record as part of the IA.
Edit: Small correction to only process logic if ShippingStreet/BillingStreet is populated, as not everyone may have rules in SF enforcing these fields to be populated before activation.
Comments
A quick note on the Address 2 regex. It finds the first line break, then cleans up any leading white-space on the line.
If you want to be more accurate on your mapping, you may wish to do ^.*[\r\n]* as this will leave your messy data intact as it's represented in the source material. That may be more of a personal preference.
This approach does not address if your NetSuite environment is setup with three street line entries, but this should give you a head start on the approach. (Exercise left to the reader etc.)
Open to feedback on the regex above, etc. I am also using these in a Python script for some data work/cleanup as well, it seems relatively portable.
Super Helpful! I was getting extremely frustrated with this same issue and this solved it instantly!
Please sign in to leave a comment.