menu

SiteGenesis / Server-side JS / Module: models/AddressModel

Model for address functionality.

Source:

module:models/AddressModel

The order class

Source:

Classes

AddressModel

Methods

(inner) AddressModel/create(addressFormopt) → {module:models/AddressModel~AddressModel}T

Creates a new address.

Parameters:
Name Type Attributes Description
addressForm dw.web.FormGroup <optional>

The form which is used to update the address

Source:
Returns:

The created address.

Type
module:models/AddressModel~AddressModel

(inner) AddressModel/get(parameter) → {module:models/AddressModel~AddressModel}

Gets a new instance for a given address or address ID.

Parameters:
Name Type Description
parameter dw.order.OrderAddress | dw.customer.CustomerAddress | String

The address object to enhance/wrap or an address ID.

Source:
Returns:

If passed an address object object, returns the address object. If passed a string, uses the string as the address ID to get the string.

Type
module:models/AddressModel~AddressModel

(inner) AddressModel/remove(addressId) → {Boolean}T

Removes the address for the given address ID. Note: the deletion fails if the address is still associated with a product list.

Parameters:
Name Type Description
addressId String

The ID of the address to delete

Source:
See:
  • module:models/AddressModel~AddressModel#remove
Returns:

true if the address was successfully deleted, false otherwise

Type
Boolean

(inner) AddressModel/remove() → {Boolean}T

Removes the address. Note that the deletion will fail in case the address is still associated with a product list

Source:
Returns:

true if the address was successfully deleted, false otherwise.

Type
Boolean

(inner) AddressModel/update(address, addressFormopt) → {module:models/AddressModel~AddressModel|null}T

Updates an existing address using the given form group.

Parameters:
Name Type Attributes Description
address String

ID used to get an address.

addressForm dw.web.FormGroup <optional>

The form that is used to update the address.

Source:
Returns:

The updated address or null if the address cannot be saved to the associated Salesforce Commerce Cloud system object.

Type
module:models/AddressModel~AddressModel | null