About the Address Subrecord
The address subrecord has some unique characteristics. This means working with the address subrecord might be a bit different than with other subrecords. For details, see the following sections:
See also Scripting Transaction Shipping and Billing Addresses.
Billing and Shipping Addresses Can Be Sourced from Other Records
Most subrecords are unique to the record they're created on. However, in some cases, a single address subrecord instance can be referenced by multiple records.
For example: You can create multiple addresses for an entity. When you create a transaction for that entity, you can use one of its existing addresses for shipping or billing. This means setting shipping or billing addresses can work a bit differently than other address fields. For details, see Addresses Can Be Sourced from Entity Records.
The Address Subrecord Can Have Custom Forms
Compared with other subrecords, the address subrecord is unique in that you can create custom entry forms for it. For example, you may want to create custom forms for different countries.
If your account has multiple address forms, and if you are not seeing the expected results, the reason could be related to the form. In particular, if your script is using dynamic mode, the first value you set on the subrecord form should be country. The reason is that if you set a value for country that differs from the default, the form resets when the country value changes. Set the country value first as a best practice.
The Override, Phone, and Zip fields of the address subrecord aren't available as search filters from the customer record.
Address Data Is Summarized on the Parent Record
Most subrecords don't show a summary of their details on the parent record in the UI. You have to open the subrecord in its own window to view its data.
The address subrecord is an exception to this rule. When you enter address subrecord details and go back to the main record view, the system usually shows a summary of what you entered. For example, in the following screenshot, subrecord data is summarized in the Address column.

This summary shows the value of the addrtext field on the address subrecord. This value is created through the use of a template and generated from other values entered on the subrecord, such as the values for the city and state fields. Each address form can have its own template for determining the addrtext value. You can view an address form's template by checking its record at Customization > Forms > Address Forms.
An error in the addrtext field doesn't mean there's an error in the other subrecord values. If an error exists in the summary, review the template to make sure that it is capturing the values you intend.
To view the values for all of the fields on the subrecord, do one of the following:
-
Use one of the following methods to retrieve the subrecord: getCurrentSublistSubrecord(), getSublistSubrecord(), or getSubrecord(). For an example, see Retrieving an Address Subrecord Example.
-
In the UI, open the subrecord for editing in its own window.
Client Scripts Attached to the Address Subrecord
Client scripts on address subrecords in transactions might run on both the server and client. This is normal behavior, so be aware of it. To run the logic only one time, wrap it in an if
statement that exits the script on the server. For example:
if (typeof document!=='undefined') {
// client script logic
}
If a client script attached to an address subrecord loads the N/currentRecord Module, the script fails. Although you can't load the N/currentRecord Module in a client script that is attached to the address subrecord, you can get currentRecord from context.currentRecord:
define([],function(){
function saveRecord(context){
var currentRecord = context.currentRecord;
return true;
}
return {
saveRecord: saveRecord
}
});
See currentRecord.CurrentRecord.
You can attach client scripts to custom entry forms, custom transaction forms, or custom address forms. See Attaching a Client Script to a Form.
For information about client scripts, see SuiteScript 2.x Client Script Type.