here is the code snippet we are using salesorder.s...
# suitescript
r
here is the code snippet we are using salesorder.setValue({ fieldId: 'shipaddresslist', value: '-2', ignoreFieldChange: true }); // salesorder.getSubrecord({ // 'fieldId': 'addressbookaddress' // }); salesorder.setValue({ fieldId: 'shipcountry', value: 'US' }); salesorder.setValue({ fieldId: 'shipattention', value: shippingAddress.attention }); salesorder.setValue({ fieldId: 'shipaddressee', value: shippingAddress.addressee }); salesorder.setValue({ fieldId: 'shipphone', value: shippingAddress.phone }); salesorder.setValue({ fieldId: 'shipaddr1', value: shippingAddress.addressLine1 }); salesorder.setValue({ fieldId: 'shipaddr2', value: shippingAddress.addressLine2 }); salesorder.setValue({ fieldId: 'shipcity', value: shippingAddress.city }); salesorder.setText({ fieldId: 'shipstate', text: shippingAddress.state }); salesorder.setValue({ fieldId: 'shipzip', value: shippingAddress.zip }); var shipping += shippingAddress.addressLine1 + '\n' + shippingAddress.addressLine2 + '\n' + shippingAddress.city + '\n' + shippingAddress.country + '\n' + shippingAddress.state + '\n' + shippingAddress.zip; salesorder.setValue({ fieldId: 'shipaddress', value: shipping }); }
m
I see a couple of things for you to look at and check: shipaddress has city - country - state instead of city, state zip. country doesn't have to be in the shipaddress text (at least it didn't for me) and you should add a comma between city and state. The next thing to check is what are you using for a value for state. NS doesn't expose the internal Id's for states. I had created a custom record to map the Id's and abbreviations. There's a suiteAnswer 38434 that explains that.
@raju There's a SS 2.0 example in SuiteAnswers 61081 that may be of some help to you also. If you go the address subrecord route, the address subrecord is sourced from the customer, not the sales order.
r
@mbucklaew I figured out the solution. Thanks.
👍 1
I have used the code below to get subrecord and setting the values to it var subRecord = salesorder.getSubrecord({ 'fieldId': 'shippingaddress' });