How to get custom field of shipping address of item fulfillment when fulfilling transfer order

I am writing a beforeLoad handler in a user event script for an item fulfillment record. I want to get the value of a custom field on the shipping address record. I need it to work for fulfillments of sales orders and transfer orders.

When the item fulfillment is for a sales order, the object returned by context.newRecord.getSubrecord(‘shippingaddress’) does contain custom fields.
However, when the item fulfillment is for a transfer order, the object returned by context.newRecord.getSubrecord(‘shippingaddress’) does *NOT* contain custom fields.

So I want to try to load the address record using its internal id, and see if the result includes custom fields. Ideally I’d like to use record.load, but record.Type.ADDRESS doesn’t seem to exist, according to https://docs.oracle.com/cloud/latest/netsuitecs_gs/NSAPI/NSAPI.pdf.

So I thought about doing a search for addresses by internal id, but the search results would not include custom fields, according to https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2019_2/script/record/address.html.

And anyway, I can’t see how to get the internal id of the shipping address from the item fulfillment. Of all the fields listed at https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2019_2/script/record/itemfulfillment.html, none seem to provide the internal id of the shipping address. I’ve tried getting it from the result of context.newRecord.getSubrecord(‘shippingaddress’) but with no success.

So I’m stuck. Any ideas?

I’ve also posted this question at https://stackoverflow.com/questions/60530341/how-to-get-custom-field-of-shipping-address-of-item-fulfillment-when-fulfilling

Rookie Asked on March 4, 2020 in SuiteScript.
Add Comment
1 Answer(s)

Have you tried loading the shipping address from the Transfer Order it was created from?

Beginner Answered on March 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor