Sets new [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md) for the customer or overwrites the existing context. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### geolocation
- geolocation: [Geolocation](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Geolocation.md) `(read-only)`
- : Gets the [Geolocation](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Geolocation.md) object for the clientIP set in
[ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md) or null if no shopperContext is found, or no clientIP was set
or Geolocation for the clientIP was not found.
The method throws an exception if the call fails.
---
### shopperContext
- shopperContext: [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md)
- : Returns the [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md) if it exists for the customer. Returns null if it
does not exist.
---
## Method Details
### getGeolocation()
- static getGeolocation(): [Geolocation](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Geolocation.md)
- : Gets the [Geolocation](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Geolocation.md) object for the clientIP set in
[ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md) or null if no shopperContext is found, or no clientIP was set
or Geolocation for the clientIP was not found.
The method throws an exception if the call fails.
**Throws:**
- dw.customer.shoppercontext.ShopperContextException - This exception is thrown if error occurs while trying to retrieve Geolocation string from the Shopper Context.
---
### getShopperContext()
- static getShopperContext(): [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md)
- : Returns the [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md) if it exists for the customer. Returns null if it
does not exist.
**Returns:**
- The Shopper Context or null.
**Throws:**
- dw.customer.shoppercontext.ShopperContextException - This exception is thrown if an error occurs while fetching the Shopper Context.
---
### removeShopperContext()
- static removeShopperContext(): void
- : Removes the [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md) for the customer.
The method throws an exception if the deletion of Shopper Context fails.
**Throws:**
- dw.customer.shoppercontext.ShopperContextException - This exception is thrown if error occurs while deleting the Shopper Context.
---
### setShopperContext(ShopperContext, Boolean)
- static setShopperContext(shopperContext: [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md), evaluateContextWithClientIP: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): void
- :
Sets new [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md) for the customer or overwrites the existing context.
Note: This method does not save the attributes from the given Shopper Context such as - custom session
attributes, source code, effective date time etc., - in the current session object. These attributes are read
from Shopper Context and stored in the corresponding session attributes during subsequent requests and not in the
current request. Hence, promotions, price books etc., are triggered in subsequent requests.
If `clientIP` is set in [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md), the geolocation information
is retrieved and set in `x-geolocation` header.
And if the parameter `evaluateContextWithClientIP` is set to true, the `clientIP` will be
saved to the Shopper Context.
If parameter `evaluateContextWithClientIP` is set to false, the `clientIP` will not be
saved to the Shopper Context.
If the `geoLocation` attribute is set, it overrides any geolocation context set by
`clientIP`.
**Parameters:**
- shopperContext - The new Shopper Context to set. See documentation for [ShopperContext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.shoppercontext.ShopperContext.md)
- evaluateContextWithClientIP - The boolean to determine if Shopper Context should be evaluated with clientIP address.
**Throws:**
- dw.customer.shoppercontext.ShopperContextException - This exception is thrown if the Shopper Context is not saved or if validation fails.
---
# Class Signature
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.crypto.Signature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md)
This class allows access to signature services offered through the Java
Cryptography Architecture (JCA). At this time the signature/verification implementation of the
methods is based on the default RSA JCE provider of the JDK - sun.security.rsa.SunRsaSign
dw.crypto.Signature is an adapter to the security provider implementation
and covers several digest algorithms:
- SHA1withRSA (deprecated)
- SHA256withRSA
- SHA384withRSA
- SHA512withRSA
- SHA256withRSA/PSS
- SHA384withRSA/PSS
- SHA512withRSA/PSS
- SHA256withECDSA
- SHA384withECDSA
- SHA512withECDSA
Key size generally ranges between 512 and 65536 bits (the latter of which is unnecessarily large).
Default key size for RSA is 1024. SHA384withRSA and SHA512withRSA require a key with length of at least 1024 bits.
For ECDSA, the following key sizes are supported:
- SHA256withECDSA: 256-bit key (NIST P-256)
- SHA384withECDSA: 384-bit key (NIST P-384)
- SHA512withECDSA: 521-bit key (NIST P-521)
When choosing a key size - beware of the tradeoff between security and processing time:
The longer the key, the harder to break it but also it takes more time for the two sides to sign and verify the signature.
An exception will be thrown for keys shorter than 2048 bits in this version of the API.
**Note:** this class handles sensitive security-related data.
Pay special attention to PCI DSS v3. requirements 2, 4, 12, and other relevant requirements.
## Constant Summary
| Constant | Description |
| --- | --- |
| [SUPPORTED_DIGEST_ALGORITHMS_AS_ARRAY](#supported_digest_algorithms_as_array): [String\[\]](TopLevel.String.md) | Supported digest algorithms exposed as a string array |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Signature](#signature)() | |
## Method Summary
| Method | Description |
| --- | --- |
| [isDigestAlgorithmSupported](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#isdigestalgorithmsupportedstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Checks to see if a digest algorithm is supported |
| [sign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#signstring-keyref-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Signs a string and returns a string |
| [sign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#signstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Signs a string and returns a string |
| [signBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#signbytesbytes-keyref-string)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Signs bytes and returns bytes |
| [signBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#signbytesbytes-string-string)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Signs bytes and returns bytes |
| [verifyBytesSignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#verifybytessignaturebytes-bytes-certificateref-string)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Verifies a signature supplied as bytes |
| [verifyBytesSignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#verifybytessignaturebytes-bytes-string-string)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Verifies a signature supplied as bytes |
| [verifySignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#verifysignaturestring-string-certificateref-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Verifies a signature supplied as string |
| [verifySignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md#verifysignaturestring-string-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Verifies a signature supplied as string |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### SUPPORTED_DIGEST_ALGORITHMS_AS_ARRAY
- SUPPORTED_DIGEST_ALGORITHMS_AS_ARRAY: [String\[\]](TopLevel.String.md)
- : Supported digest algorithms exposed as a string array
---
## Constructor Details
### Signature()
- Signature()
- :
---
## Method Details
### isDigestAlgorithmSupported(String)
- isDigestAlgorithmSupported(digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Checks to see if a digest algorithm is supported
**Parameters:**
- digestAlgorithm - the digest algorithm name
**Returns:**
- a boolean indicating success (true) or failure (false)
---
### sign(String, KeyRef, String)
- sign(contentToSign: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Signs a string and returns a string
**Parameters:**
- contentToSign - base64 encoded content to sign
- privateKey - a reference to a private key entry in the keystore
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- the base64 encoded signature
---
### sign(String, String, String)
- sign(contentToSign: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), privateKey: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Signs a string and returns a string
**Parameters:**
- contentToSign - base64 encoded content to sign
- privateKey - base64 encoded private key
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- the base64 encoded signature
---
### signBytes(Bytes, KeyRef, String)
- signBytes(contentToSign: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Signs bytes and returns bytes
**Parameters:**
- contentToSign - transformed with UTF-8 encoding into a byte stream
- privateKey - a reference to a private key entry in the keystore
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- signature
---
### signBytes(Bytes, String, String)
- signBytes(contentToSign: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), privateKey: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Signs bytes and returns bytes
**Parameters:**
- contentToSign - transformed with UTF-8 encoding into a byte stream
- privateKey - base64 encoded private key
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- signature
---
### verifyBytesSignature(Bytes, Bytes, CertificateRef, String)
- verifyBytesSignature(signature: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), contentToVerify: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), certificate: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Verifies a signature supplied as bytes
**Parameters:**
- signature - signature to check as bytes
- contentToVerify - as bytes
- certificate - a reference to a trusted certificate
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- a boolean indicating success (true) or failure (false)
---
### verifyBytesSignature(Bytes, Bytes, String, String)
- verifyBytesSignature(signature: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), contentToVerify: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), publicKey: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Verifies a signature supplied as bytes
**Parameters:**
- signature - signature to check as bytes
- contentToVerify - as bytes
- publicKey - base64 encoded public key
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- a boolean indicating success (true) or failure (false)
---
### verifySignature(String, String, CertificateRef, String)
- verifySignature(signature: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contentToVerify: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), certificate: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Verifies a signature supplied as string
**Parameters:**
- signature - base64 encoded signature
- contentToVerify - base64 encoded content to verify
- certificate - a reference to a trusted certificate
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- a boolean indicating success (true) or failure (false)
---
### verifySignature(String, String, String, String)
- verifySignature(signature: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contentToVerify: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), publicKey: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Verifies a signature supplied as string
**Parameters:**
- signature - base64 encoded signature
- contentToVerify - base64 encoded content to verify
- publicKey - base64 encoded public key
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- a boolean indicating success (true) or failure (false)
---
# Class SimpleExtensible
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.SimpleExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SimpleExtensible.md)
Base class alternative to ExtensibleObject for customizable objects which do not rely on the metadata system.
Unlike Extensible any custom attributes can be set on the fly and are not checked against an available list.
Similar to Extensible method [getCustom()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SimpleExtensible.md#getcustom) is the central point to retrieve and store the objects attribute
values.
## Property Summary
| Property | Description |
| --- | --- |
| [custom](#custom): [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md) `(read-only)` | Returns the custom attributes for this object. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SimpleExtensible.md#getcustom)() | Returns the custom attributes for this object. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### custom
- custom: [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md) `(read-only)`
- : Returns the custom attributes for this object.
---
## Method Details
### getCustom()
- getCustom(): [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md)
- : Returns the custom attributes for this object.
**Returns:**
- the custom attributes for this object.
---
# Class Site
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.system.Site](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md)
This class represents a site in Commerce Cloud Digital and provides access to
several site-level configuration values which are managed from within the
Business Manager. It is only possible to get a reference to the current site
as determined by the current request. The static method
[getCurrent()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getcurrent) returns a reference to the current site.
## Constant Summary
| Constant | Description |
| --- | --- |
| [SITE_STATUS_MAINTENANCE](#site_status_maintenance): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 3 | Constant that represents the Site under maintenance/offline |
| [SITE_STATUS_ONLINE](#site_status_online): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | Constant that represents the Site is Online |
| [SITE_STATUS_PROTECTED](#site_status_protected): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 5 | Constant that represents the Site is in preview mode or online/password (protected) |
## Property Summary
| Property | Description |
| --- | --- |
| [ID](#id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the site. |
| ~~[OMSEnabled](#omsenabled): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~ `(read-only)` | Whether oms is active in the current site. |
| [allSites](#allsites): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)` | Returns all sites. |
| [allowedCurrencies](#allowedcurrencies): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)` | Returns the allowed currencies of the current site as a collection of currency codes. |
| [allowedLocales](#allowedlocales): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)` | Returns the allowed locales of the current site as a collection of locale ID's. |
| [calendar](#calendar): [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md) `(read-only)` | Returns a new Calendar object in the time zone of the current site. |
| ~~[currencyCode](#currencycode): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ `(read-only)` | Returns the default currency code for the current site. |
| [current](#current): [Site](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md) `(read-only)` | Returns the current site. |
| [defaultCurrency](#defaultcurrency): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the default currency code for the current site. |
| [defaultLocale](#defaultlocale): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Return default locale for the site. |
| [einsteinSiteID](#einsteinsiteid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the Einstein site Id. |
| [httpHostName](#httphostname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the configured HTTP host name. |
| [httpsHostName](#httpshostname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the configured HTTPS host name. |
| [name](#name): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns a descriptive name for the site. |
| [pageMetaTags](#pagemetatags): [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md) `(read-only)` | Returns all page meta tags, defined for this instance for which content can be generated. |
| [preferences](#preferences): [SitePreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.SitePreferences.md) `(read-only)` | This method returns a container of all site preferences of this site. |
| [status](#status): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the status of this site. |
| [timezone](#timezone): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the code for the time zone in which the storefront is running. |
| [timezoneOffset](#timezoneoffset): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns time zone offset in which the storefront is running. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [getAllSites](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getallsites)() | Returns all sites. |
| [getAllowedCurrencies](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getallowedcurrencies)() | Returns the allowed currencies of the current site as a collection of currency codes. |
| [getAllowedLocales](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getallowedlocales)() | Returns the allowed locales of the current site as a collection of locale ID's. |
| static [getCalendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getcalendar)() | Returns a new Calendar object in the time zone of the current site. |
| ~~[getCurrencyCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getcurrencycode)()~~ | Returns the default currency code for the current site. |
| static [getCurrent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getcurrent)() | Returns the current site. |
| [getCustomPreferenceValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getcustompreferencevaluestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a custom preference value. |
| [getDefaultCurrency](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getdefaultcurrency)() | Returns the default currency code for the current site. |
| [getDefaultLocale](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getdefaultlocale)() | Return default locale for the site. |
| [getEinsteinSiteID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#geteinsteinsiteid)() | Returns the Einstein site Id. |
| [getHttpHostName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#gethttphostname)() | Returns the configured HTTP host name. |
| [getHttpsHostName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#gethttpshostname)() | Returns the configured HTTPS host name. |
| [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getid)() | Returns the ID of the site. |
| [getName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getname)() | Returns a descriptive name for the site. |
| [getPageMetaTag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getpagemetatagstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the page meta tag for the specified id. |
| [getPageMetaTags](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getpagemetatags)() | Returns all page meta tags, defined for this instance for which content can be generated. |
| [getPreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getpreferences)() | This method returns a container of all site preferences of this site. |
| [getStatus](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getstatus)() | Returns the status of this site. |
| [getTimezone](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#gettimezone)() | Returns the code for the time zone in which the storefront is running. |
| [getTimezoneOffset](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#gettimezoneoffset)() | Returns time zone offset in which the storefront is running. |
| ~~[isOMSEnabled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#isomsenabled)()~~ | Whether oms is active in the current site. |
| [setCustomPreferenceValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#setcustompreferencevaluestring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | The method sets a value for a custom preference. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### SITE_STATUS_MAINTENANCE
- SITE_STATUS_MAINTENANCE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 3
- : Constant that represents the Site under maintenance/offline
---
### SITE_STATUS_ONLINE
- SITE_STATUS_ONLINE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : Constant that represents the Site is Online
---
### SITE_STATUS_PROTECTED
- SITE_STATUS_PROTECTED: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 5
- : Constant that represents the Site is in preview mode or online/password (protected)
---
## Property Details
### ID
- ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the site.
---
### OMSEnabled
- ~~OMSEnabled: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~ `(read-only)`
- : Whether oms is active in the current site. This depends on a general
property which states whether oms is active for the server,
and a site-dependent preference whether oms is available for the current site.
---
### allSites
- allSites: [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)`
- : Returns all sites.
---
### allowedCurrencies
- allowedCurrencies: [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)`
- : Returns the allowed currencies of the current site as a collection of
currency codes.
---
### allowedLocales
- allowedLocales: [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)`
- : Returns the allowed locales of the current site as a collection of
locale ID's.
---
### calendar
- calendar: [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md) `(read-only)`
- : Returns a new Calendar object in the time zone of the
current site.
---
### currencyCode
- ~~currencyCode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ `(read-only)`
- : Returns the default currency code for the current site.
**Deprecated:**
**warning:** Use [getDefaultCurrency()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getdefaultcurrency) method instead,
---
### current
- current: [Site](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md) `(read-only)`
- : Returns the current site.
---
### defaultCurrency
- defaultCurrency: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the default currency code for the current site.
---
### defaultLocale
- defaultLocale: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Return default locale for the site.
---
### einsteinSiteID
- einsteinSiteID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the Einstein site Id. Typically this is a concatenation of the realm, underscore character and the site id.
It can be overwritten by support users to help with realm moves to continue using the Einstein data from the old realm.
Used when making calls to the Einstein APIs.
---
### httpHostName
- httpHostName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the configured HTTP host name. If no host name
is configured the method returns the instance hostname.
---
### httpsHostName
- httpsHostName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the configured HTTPS host name. If no host name
is configured the method returns the HTTP host name or the instance hostname, if
that is not configured as well.
---
### name
- name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns a descriptive name for the site.
---
### pageMetaTags
- pageMetaTags: [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md) `(read-only)`
- : Returns all page meta tags, defined for this instance for which content can be generated.
The meta tag content is generated based on the home page meta tag context and rules.
The rules are obtained from the current repository domain.
---
### preferences
- preferences: [SitePreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.SitePreferences.md) `(read-only)`
- : This method returns a container of all site preferences of this site.
---
### status
- status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the status of this site.
Possible values are [SITE_STATUS_ONLINE](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#site_status_online), [SITE_STATUS_MAINTENANCE](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#site_status_maintenance), [SITE_STATUS_PROTECTED](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#site_status_protected)
---
### timezone
- timezone: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the code for the time zone in which the storefront is
running.
---
### timezoneOffset
- timezoneOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns time zone offset in which the storefront is running.
---
## Method Details
### getAllSites()
- static getAllSites(): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
- : Returns all sites.
**Returns:**
- all sites for the current instance
---
### getAllowedCurrencies()
- getAllowedCurrencies(): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
- : Returns the allowed currencies of the current site as a collection of
currency codes.
**Returns:**
- Collection of allowed site currencies
---
### getAllowedLocales()
- getAllowedLocales(): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
- : Returns the allowed locales of the current site as a collection of
locale ID's.
**Returns:**
- Collection if allowed site locales
---
### getCalendar()
- static getCalendar(): [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md)
- : Returns a new Calendar object in the time zone of the
current site.
**Returns:**
- the Calendar object in the time zone of the
current site.
---
### getCurrencyCode()
- ~~getCurrencyCode(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns the default currency code for the current site.
**Returns:**
- the default currency code for the current site.
**Deprecated:**
**warning:** Use [getDefaultCurrency()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getdefaultcurrency) method instead,
---
### getCurrent()
- static getCurrent(): [Site](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md)
- : Returns the current site.
**Returns:**
- the current site.
---
### getCustomPreferenceValue(String)
- getCustomPreferenceValue(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns a custom preference value. If the preference does not exist the
method returns null. This method is simply a shortcut method for
accessing the value for a custom attribute defined on the
[SitePreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.SitePreferences.md) object.
```
// Method #1
var mySitePrefValue1 : String = dw.system.Site.getCurrent().
getCustomPreferenceValue("mySitePref");
// Method #2
var sitePrefs : SitePreferences = dw.system.Site.getCurrent().getPreferences();
var mySitePrefValue2 : String = sitePrefs.getCustom()["mySitePref"];
```
**Parameters:**
- name - preference name.
**Returns:**
- the preference value, or null if there is no preference with the
given name.
---
### getDefaultCurrency()
- getDefaultCurrency(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the default currency code for the current site.
**Returns:**
- the default currency code for the current site.
---
### getDefaultLocale()
- getDefaultLocale(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Return default locale for the site.
**Returns:**
- default locale for the site.
---
### getEinsteinSiteID()
- getEinsteinSiteID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the Einstein site Id. Typically this is a concatenation of the realm, underscore character and the site id.
It can be overwritten by support users to help with realm moves to continue using the Einstein data from the old realm.
Used when making calls to the Einstein APIs.
**Returns:**
- the Einstein site Id
---
### getHttpHostName()
- getHttpHostName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the configured HTTP host name. If no host name
is configured the method returns the instance hostname.
**Returns:**
- the configured HTTP host name or if it is not
set the instance hostname.
---
### getHttpsHostName()
- getHttpsHostName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the configured HTTPS host name. If no host name
is configured the method returns the HTTP host name or the instance hostname, if
that is not configured as well.
**Returns:**
- the configured HTTPS host name or HTTP host name or the instance hostname.
---
### getID()
- getID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the site.
**Returns:**
- the ID of the site.
---
### getName()
- getName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a descriptive name for the site.
**Returns:**
- a descriptive name for the site.
---
### getPageMetaTag(String)
- getPageMetaTag(id: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [PageMetaTag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.PageMetaTag.md)
- : Returns the page meta tag for the specified id.
The meta tag content is generated based on the home page meta tag context and rule.
The rule is obtained from the current repository domain.
Null will be returned if the meta tag is undefined on the current instance, or if no rule can be found for the
current context, or if the rule resolves to an empty string.
**Parameters:**
- id - the ID to get the page meta tag for
**Returns:**
- page meta tag containing content generated based on rules
---
### getPageMetaTags()
- getPageMetaTags(): [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md)
- : Returns all page meta tags, defined for this instance for which content can be generated.
The meta tag content is generated based on the home page meta tag context and rules.
The rules are obtained from the current repository domain.
**Returns:**
- page meta tags defined for this instance, containing content generated based on rules
---
### getPreferences()
- getPreferences(): [SitePreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.SitePreferences.md)
- : This method returns a container of all site preferences of this site.
**Returns:**
- a preferences object containing all system and custom site
preferences of this site
---
### getStatus()
- getStatus(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the status of this site.
Possible values are [SITE_STATUS_ONLINE](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#site_status_online), [SITE_STATUS_MAINTENANCE](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#site_status_maintenance), [SITE_STATUS_PROTECTED](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#site_status_protected)
**Returns:**
- Status of the this site.
---
### getTimezone()
- getTimezone(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the code for the time zone in which the storefront is
running.
**Returns:**
- time zone code in which the storefront is
running.
---
### getTimezoneOffset()
- getTimezoneOffset(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns time zone offset in which the storefront is running.
**Returns:**
- time zone offset in which the storefront is running.
---
### isOMSEnabled()
- ~~isOMSEnabled(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~
- : Whether oms is active in the current site. This depends on a general
property which states whether oms is active for the server,
and a site-dependent preference whether oms is available for the current site.
**Returns:**
- whether oms is active in the site
---
### setCustomPreferenceValue(String, Object)
- setCustomPreferenceValue(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : The method sets a value for a custom preference. The type of the value
must match with the declared type of the preference definition.
**Parameters:**
- name - name of the preference
- value - new value for the preference
---
# Class SitemapFile
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.sitemap.SitemapFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapFile.md)
Instances of this class represent sitemap files located in the appservers shared file system. Methods are used to get
details of a sitemap file, such as the hostname it is associated with.
## Property Summary
| Property | Description |
| --- | --- |
| [fileName](#filename): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the name of the file e.g. |
| [fileSize](#filesize): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the size of the file in bytes. |
| [fileURL](#fileurl): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the URL used to access this file in a storefront request. |
| [hostName](#hostname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the host name this file is associated with. |
| [valid](#valid): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Checks if this instance of sitemap file is valid. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getFileName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapFile.md#getfilename)() | Returns the name of the file e.g. |
| [getFileSize](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapFile.md#getfilesize)() | Returns the size of the file in bytes. |
| [getFileURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapFile.md#getfileurl)() | Returns the URL used to access this file in a storefront request. |
| [getHostName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapFile.md#gethostname)() | Returns the host name this file is associated with. |
| [isValid](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapFile.md#isvalid)() | Checks if this instance of sitemap file is valid. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### fileName
- fileName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the name of the file e.g. sitemap\_index.xml
---
### fileSize
- fileSize: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the size of the file in bytes.
---
### fileURL
- fileURL: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the URL used to access this file in a storefront request.
---
### hostName
- hostName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the host name this file is associated with.
---
### valid
- valid: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Checks if this instance of sitemap file is valid. Examples for invalid files are:
- file size >10mb
Additional violations might be added later.
---
## Method Details
### getFileName()
- getFileName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the name of the file e.g. sitemap\_index.xml
**Returns:**
- The file's name, never `null`.
---
### getFileSize()
- getFileSize(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the size of the file in bytes.
**Returns:**
- The fileSize in bytes.
---
### getFileURL()
- getFileURL(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the URL used to access this file in a storefront request.
**Returns:**
- The fileURL, never `null`.
---
### getHostName()
- getHostName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the host name this file is associated with.
**Returns:**
- The hostname, never `null`.
---
### isValid()
- isValid(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Checks if this instance of sitemap file is valid. Examples for invalid files are:
- file size >10mb
Additional violations might be added later.
**Returns:**
- `true` if the `SitemapFile` is valid, `false` otherwise.
---
# Class SitemapMgr
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.sitemap.SitemapMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapMgr.md)
[SitemapMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapMgr.md) is used to access and modify custom sitemap files.
To access custom sitemap files, use methods [getCustomSitemapFiles()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapMgr.md#getcustomsitemapfiles).
To delete custom sitemap files, use methods [deleteCustomSitemapFile(SitemapFile)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapMgr.md#deletecustomsitemapfilesitemapfile),
[deleteCustomSitemapFiles(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapMgr.md#deletecustomsitemapfilesstring) and [deleteCustomSitemapFiles()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapMgr.md#deletecustomsitemapfiles).
To add custom sitemap files, use methods [addCustomSitemapFile(String, File)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.sitemap.SitemapMgr.md#addcustomsitemapfilestring-file). The file will be copied from
WebDAV ([File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md) represent a file in WebDAV) to the appservers shared file system.
Please note that all provided methods are operating in appservers shared file system. These modifications are visible
via "Custom Sitemaps" tab under _Merchant Tools_ => _SEO_ => _Sitemaps - Custom Sitemaps_ in
Business Manager. To publish all changes, execute job under Merchant Tools => SEO => Sitemaps => Job.
## Property Summary
| Property | Description |
| --- | --- |
| [customSitemapFiles](#customsitemapfiles): [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)` | Reads all existing custom sitemap files from files system of the appservers custom sitemap directory into memory and returns them in a Map containing mappings like
/`), the old
location (`.../sitemaps/`) is used as a fallback.
**Parameters:**
- fileName - The name of the sitemap file to read (e.g. "sitemap\_index.xml"). Must not be `null`, empty, or contain path traversal sequences.
**Returns:**
- The sitemap file content as a String, or `null` if the fileName is
invalid, the file does not exist, or the request context is unavailable.
---
# Class SitePreferences
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- [dw.object.ExtensibleObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md)
- [dw.system.SitePreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.SitePreferences.md)
SitePreferences is a container for custom site-level attributes. The object
corresponds with system object type "SitePreferences". It has no system
attributes and exists only as a place for merchants to define custom
attributes which need to be available for each site.
Logically there is only one SitePreferences instance per site. The instance
is obtained by calling [Site.getPreferences()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Site.md#getpreferences). Once an
instance of the container is obtained, it is possible to read/write site
preference values by using the usual syntax for
[ExtensibleObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md) instances. For example:
```
var sitePrefs : SitePreferences = dw.system.Site.getCurrent().getPreferences();
var mySitePrefValue : String = sitePrefs.getCustom()["mySitePref"];
```
**Note:** this class allows access to sensitive security-related data.
Pay special attention to PCI DSS v3. requirements 2, 4, and 12.
Commerce Cloud Digital defines many site-level preferences, relating to
baskets, timezone, locales, customers, etc, which can be managed within the
"Site Preferences" module of the Business Manager, but these preferences are
not accessible through this object. (SourceCodeURLParameterName is the one
exception to this rule.)
## Property Summary
| Property | Description |
| --- | --- |
| [sourceCodeURLParameterName](#sourcecodeurlparametername): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the name of the source code url paremeter configured for the site. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getSourceCodeURLParameterName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.SitePreferences.md#getsourcecodeurlparametername)() | Returns the name of the source code url paremeter configured for the site. |
### Methods inherited from class ExtensibleObject
[describe](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#describe), [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#getcustom)
### Methods inherited from class PersistentObject
[getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### sourceCodeURLParameterName
- sourceCodeURLParameterName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the name of the source code url paremeter configured for the
site.
---
## Method Details
### getSourceCodeURLParameterName()
- getSourceCodeURLParameterName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the name of the source code url paremeter configured for the
site.
**Returns:**
- source code url parameter name
---
# Class SlotContent
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.campaign.SlotContent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SlotContent.md)
Represents content for a slot.
## Property Summary
| Property | Description |
| --- | --- |
| [calloutMsg](#calloutmsg): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)` | Returns the callout message for the slot. |
| [content](#content): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns a collection of content based on the content type for the slot. |
| [custom](#custom): [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)` | Returns the custom attributes for the slot. |
| [recommenderName](#recommendername): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the recommender name for slot configurations of type 'Recommendation' |
| [slotID](#slotid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the unique slot ID. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getCalloutMsg](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SlotContent.md#getcalloutmsg)() | Returns the callout message for the slot. |
| [getContent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SlotContent.md#getcontent)() | Returns a collection of content based on the content type for the slot. |
| [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SlotContent.md#getcustom)() | Returns the custom attributes for the slot. |
| [getRecommenderName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SlotContent.md#getrecommendername)() | Returns the recommender name for slot configurations of type 'Recommendation' |
| [getSlotID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SlotContent.md#getslotid)() | Returns the unique slot ID. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### calloutMsg
- calloutMsg: [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`
- : Returns the callout message for the slot.
---
### content
- content: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns a collection of content based on the content type
for the slot. The collection will include one of the following
types: [Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md), [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md), [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md), or [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md).
---
### custom
- custom: [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)`
- : Returns the custom attributes for the slot.
---
### recommenderName
- recommenderName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the recommender name for slot configurations of type 'Recommendation'
---
### slotID
- slotID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the unique slot ID.
---
## Method Details
### getCalloutMsg()
- getCalloutMsg(): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md)
- : Returns the callout message for the slot.
**Returns:**
- Callout message of the slot.
---
### getContent()
- getContent(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns a collection of content based on the content type
for the slot. The collection will include one of the following
types: [Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md), [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md), [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md), or [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md).
**Returns:**
- All content of the slot.
---
### getCustom()
- getCustom(): [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md)
- : Returns the custom attributes for the slot.
**Returns:**
- Custom attributes of the slot.
---
### getRecommenderName()
- getRecommenderName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the recommender name for slot configurations of type 'Recommendation'
**Returns:**
- the recommender name for slot configurations of type 'Recommendation'
---
### getSlotID()
- getSlotID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the unique slot ID.
**Returns:**
- ID of the slot.
---
# Class SOAPService
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.svc.Service](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md)
- [dw.svc.SOAPService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPService.md)
Represents a SOAP WebService.
## Property Summary
| Property | Description |
| --- | --- |
| [authentication](#authentication): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Returns the authentication type. |
| [serviceClient](#serviceclient): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md) | Returns the serviceClient object. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getAuthentication](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPService.md#getauthentication)() | Returns the authentication type. |
| [getServiceClient](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPService.md#getserviceclient)() | Returns the serviceClient object. |
| [setAuthentication](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPService.md#setauthenticationstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets the type of authentication. |
| [setServiceClient](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPService.md#setserviceclientobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Sets the serviceClient object. |
### Methods inherited from class Service
[call](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#callobject), [getConfiguration](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#getconfiguration), [getCredentialID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#getcredentialid), [getRequestData](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#getrequestdata), [getResponse](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#getresponse), [getURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#geturl), [isMock](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#ismock), [isThrowOnError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#isthrowonerror), [setCredentialID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#setcredentialidstring), [setMock](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#setmock), [setThrowOnError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#setthrowonerror), [setURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.Service.md#seturlstring)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### authentication
- authentication: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the authentication type.
---
### serviceClient
- serviceClient: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the serviceClient object.
---
## Method Details
### getAuthentication()
- getAuthentication(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the authentication type.
**Returns:**
- Authentication type.
---
### getServiceClient()
- getServiceClient(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the serviceClient object.
**Returns:**
- serviceClient object.
---
### setAuthentication(String)
- setAuthentication(authentication: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [SOAPService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPService.md)
- : Sets the type of authentication. Valid values include "BASIC" and "NONE".
The default value is BASIC.
**Parameters:**
- authentication - Type of authentication.
**Returns:**
- this SOAP WebService.
---
### setServiceClient(Object)
- setServiceClient(o: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [SOAPService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPService.md)
- : Sets the serviceClient object. This must be set in the prepareCall method, prior to execute being called.
**Parameters:**
- o - serviceClient object.
**Returns:**
- this SOAP WebService.
---
# Class SOAPServiceDefinition
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.svc.ServiceDefinition](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceDefinition.md)
- [dw.svc.SOAPServiceDefinition](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPServiceDefinition.md)
Represents a SOAP WebService definition.
**Deprecated:**
**warning:** This class is only used with the deprecated [ServiceRegistry](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceRegistry.md). Use the [LocalServiceRegistry](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.LocalServiceRegistry.md)
instead, which allows configuration on the [SOAPService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.SOAPService.md) directly.
**API Version:**
**note:** No longer available as of version 19.10.
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
### Methods inherited from class ServiceDefinition
[configure](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceDefinition.md#configureobject), [getConfiguration](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceDefinition.md#getconfiguration), [getServiceName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceDefinition.md#getservicename), [isMock](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceDefinition.md#ismock), [isThrowOnError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceDefinition.md#isthrowonerror), [setMock](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceDefinition.md#setmock), [setThrowOnError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.svc.ServiceDefinition.md#setthrowonerror)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
# Class SOAPUtil
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.rpc.SOAPUtil](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md)
Utility class for working with SOAP web services. This class provides
methods for setting SOAP headers and a set of constants representing the
supported header names.
If you want to use ws-security features, such as signing and encryption,
with your RPC-style SOAP web service, use this class to construct a HashMap with
security constants and values.
**Note:** this method handles sensitive security-related data.
Pay special attention to PCI DSS v3. requirements 2, 4, and 12.
The following example configures the ws-security actions taken for the request and response to a web service.
```
importPackage( dw.system );
importPackage( dw.util );
importPackage( dw.rpc );
function execute( args : PipelineDictionary ) : Number
{
var WSU_NS : String = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
try
{
// define a map with all the secrets
var secretsMap : Map = new HashMap();
secretsMap.put("myclientkey", "ckpass");
secretsMap.put("myservicekey", "ckpass");
secretsMap.put("username", "password");
var requestCfg : Map = new HashMap();
// define the ws actions to be performed
requestCfg.put(SOAPUtil.WS_ACTION, SOAPUtil.WS_USERNAME_TOKEN + " " +
SOAPUtil.WS_TIMESTAMP + " " +
SOAPUtil.WS_SIGNATURE + " " +
SOAPUtil.WS_ENCRYPT);
requestCfg.put(SOAPUtil.WS_USER, "username");
requestCfg.put(SOAPUtil.WS_PASSWORD_TYPE, SOAPUtil.WS_PW_DIGEST );
requestCfg.put(SOAPUtil.WS_SIG_DIGEST_ALGO, "http://www.w3.org/2001/04/xmlenc#sha256" );
// define signature properties
// the keystore file has the basename of the WSDL file and the
// file extension based on the keystore type (e.g. HelloWorld.jks).
// The keystore file has to be placed beside the WSDL file.
requestCfg.put(SOAPUtil.WS_SIG_PROP_KEYSTORE_TYPE, "jks");
requestCfg.put(SOAPUtil.WS_SIG_PROP_KEYSTORE_PW, "cspass");
requestCfg.put(SOAPUtil.WS_SIG_PROP_KEYSTORE_ALIAS, "myclientkey");
requestCfg.put(SOAPUtil.WS_SIGNATURE_USER, "myclientkey");
// define enrcryption properties
requestCfg.put(SOAPUtil.WS_ENC_PROP_KEYSTORE_TYPE, "jks");
requestCfg.put(SOAPUtil.WS_ENC_PROP_KEYSTORE_PW, "cspass");
requestCfg.put(SOAPUtil.WS_ENC_PROP_KEYSTORE_ALIAS, "myservicekey");
requestCfg.put(SOAPUtil.WS_ENCRYPTION_USER, "myservicekey");
requestCfg.put(SOAPUtil.WS_SIGNATURE_PARTS, "{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body");
requestCfg.put(SOAPUtil.WS_ENCRYPTION_PARTS,"{Element}{" + WSU_NS + "}
Timestamp;"+"{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body");
// set the secrets for the callback
requestCfg.put(SOAPUtil.WS_SECRETS_MAP, secretsMap);
var responseCfg : Map = new HashMap();
// define the ws actions to be performed for the response
responseCfg.put(SOAPUtil.WS_ACTION, SOAPUtil.WS_TIMESTAMP + " " +
SOAPUtil.WS_SIGNATURE + " " +
SOAPUtil.WS_ENCRYPT);
// define signature properties
responseCfg.put(SOAPUtil.WS_SIG_PROP_KEYSTORE_TYPE, "jks");
responseCfg.put(SOAPUtil.WS_SIG_PROP_KEYSTORE_PW, "cspass");
responseCfg.put(SOAPUtil.WS_SIG_PROP_KEYSTORE_ALIAS, "myservicekey");
responseCfg.put(SOAPUtil.WS_SIGNATURE_USER, "myservicekey");
// define decryption properties
responseCfg.put(SOAPUtil.WS_ENC_PROP_KEYSTORE_TYPE, "jks");
responseCfg.put(SOAPUtil.WS_ENC_PROP_KEYSTORE_PW, "cspass");
responseCfg.put(SOAPUtil.WS_ENC_PROP_KEYSTORE_ALIAS, "myclientkey");
responseCfg.put(SOAPUtil.WS_ENCRYPTION_USER, "myclientkey");
// set the secrets for the callback
responseCfg.put(SOAPUtil.WS_SECRETS_MAP, secretsMap);
// get the service and stub
var helloWorldService : WebReference = webreferences.HelloWorld;
var stub : Stub = helloWorldService.defaultService;
// set the security
SOAPUtil.setWSSecurityConfig(stub, requestCfg, responseCfg);
//var h : Hello = new helloWorldService.Hello();
var h = new helloWorldService.com.support.ws.security.test.Hello2();
h.setName('Send Text from client Axis ...');
// call the web service
var response = stub.hello2(h);
//var response = stub.hello(h);
var result = response.getHello2Return();
args.OutStr = result;
Logger.error("Hello World We Are SIGNED old version Send Text from client ...", result);
return PIPELET_NEXT;
}
catch (e)
{
Logger.error("Error in helloWorldRpc.ds is: " + e);
return PIPELET_ERROR;
}
}
```
**See Also:**
- [Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md)
- [WebReference](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.WebReference.md)
**Deprecated:**
**warning:** This class is deprecated, please use webreferences2 instead (see also [WSUtil](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md)).
## Constant Summary
| Constant | Description |
| --- | --- |
| ~~[WS_ACTION](#ws_action): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "action"~~ | WS-Security action property name. |
| ~~[WS_ENCRYPT](#ws_encrypt): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Encrypt"~~ | WS-Security action: encrypt the message. |
| ~~[WS_ENCRYPTION_PARTS](#ws_encryption_parts): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionParts"~~ | WS-Security encryption: defines which parts of the request are encrypted. |
| ~~[WS_ENCRYPTION_USER](#ws_encryption_user): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionUser"~~ | WS-Security encryption: the user's name for encryption. |
| ~~[WS_ENC_PROP_KEYSTORE_ALIAS](#ws_enc_prop_keystore_alias): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystoreAlias"~~ | WS-Security encryption: the encryption/decryption keystore alias name |
| ~~[WS_ENC_PROP_KEYSTORE_PW](#ws_enc_prop_keystore_pw): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystorePassword"~~ | WS-Security encryption: the encryption/decryption keystore password |
| ~~[WS_ENC_PROP_KEYSTORE_TYPE](#ws_enc_prop_keystore_type): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystoreType"~~ | WS-Security encryption: the encryption/decryption keystore type ( jks or pkcs12 ), default is jks. |
| ~~[WS_NO_SECURITY](#ws_no_security): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "NoSecurity"~~ | WS-Security action: no security |
| ~~[WS_PASSWORD_TYPE](#ws_password_type): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "passwordType"~~ | WS-Security password type: parameter for UsernameToken action to define the encoding of the password. |
| ~~[WS_PW_DIGEST](#ws_pw_digest): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PasswordDigest"~~ | WS-Security password of type digest: use a password digest to send the password information. |
| ~~[WS_PW_TEXT](#ws_pw_text): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PasswordText"~~ | WS-Security password of type text: send the password information in clear text. |
| ~~[WS_SECRETS_MAP](#ws_secrets_map): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SecretsMap"~~ | A secrets map with the username/password entries is needed to create the password callback object. |
| ~~[WS_SIGNATURE](#ws_signature): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Signature"~~ | WS-Security action: sign the message. |
| ~~[WS_SIGNATURE_PARTS](#ws_signature_parts): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureParts"~~ | WS-Security signature: defines which parts of the request are signed. |
| ~~[WS_SIGNATURE_USER](#ws_signature_user): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureUser"~~ | WS-Security signature: the user's name for signature. |
| ~~[WS_SIG_DIGEST_ALGO](#ws_sig_digest_algo): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureDigestAlgorithm"~~ | WS-Security signature: sets the signature digest algorithm to use. |
| ~~[WS_SIG_PROP_KEYSTORE_ALIAS](#ws_sig_prop_keystore_alias): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystoreAlias"~~ | WS-Security signature: the signature keystore alias name |
| ~~[WS_SIG_PROP_KEYSTORE_PW](#ws_sig_prop_keystore_pw): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystorePassword"~~ | WS-Security signature: the signature keystore password. |
| ~~[WS_SIG_PROP_KEYSTORE_TYPE](#ws_sig_prop_keystore_type): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystoreType"~~ | WS-Security: the signature keystore type ( jks or pkcs12 ). |
| ~~[WS_TIMESTAMP](#ws_timestamp): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Timestamp"~~ | WS-Security action: add a timestamp to the security header. |
| ~~[WS_USER](#ws_user): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "user"~~ | WS-Security user name. |
| ~~[WS_USERNAME_TOKEN](#ws_username_token): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "UsernameToken"~~ | WS-Security action: add a UsernameToken identification. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [SOAPUtil](#soaputil)() | |
## Method Summary
| Method | Description |
| --- | --- |
| ~~static [getHTTPRequestHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#gethttprequestheaderobject-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Returns an HTTP request header property value using the specified key. |
| ~~static [getHTTPResponseHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#gethttpresponseheaderobject-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Returns an HTTP response header property value using the specified key. |
| ~~static [setHTTPRequestHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#sethttprequestheaderobject-string-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Sets an HTTP request header property using the specified key and value. |
| ~~static [setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setheaderobject-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Sets a new SOAPHeaderElement in the SOAP request with the namespace of the XML content. |
| ~~static [setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setheaderobject-string-boolean)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md))~~ | Sets a new SOAPHeaderElement in the SOAP request with the namespace of the XML content. |
| ~~static [setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setheaderobject-string-string-object)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))~~ | Creates a new SOAPHeaderElement with the name and namespace and places the given XML into it. |
| ~~static [setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setheaderobject-string-string-object-boolean)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md))~~ | Creates a new SOAPHeaderElement with the name and namespace and places the given XML into it. |
| ~~static [setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setheaderobject-string-string-object-boolean-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Creates a new SOAPHeaderElement with the name and namespace and places the given XML into it. |
| ~~static [setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setheaderobject-string-string-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Creates a new SOAPHeaderElement with the name and namespace and places the given XML into it. |
| ~~static [setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setheaderobject-string-string-string-boolean)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md))~~ | Creates a new SOAPHeaderElement with the name and namespace and places the given XML into it. |
| ~~static [setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setheaderobject-string-string-string-boolean-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Creates a new SOAPHeaderElement with the name and namespace and places the given XML into it. |
| ~~static [setWSSecurityConfig](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md#setwssecurityconfigobject-object-object)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))~~ | Sets the WS-Security configuration for the request and response based on the constants defined. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### WS_ACTION
- ~~WS_ACTION: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "action"~~
- : WS-Security action property name.
Allowed property values are WS\_NO\_SECURITY, WS\_TIMESTAMP, WS\_ENCRYPT, WS\_SIGNATURE, WS\_USERNAME\_TOKEN or
a space separated String with multiple values.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_ENCRYPT
- ~~WS_ENCRYPT: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Encrypt"~~
- : WS-Security action: encrypt the message.
The encryption-specific parameters define how to encrypt, which keys
to use, and other parameters.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_ENCRYPTION_PARTS
- ~~WS_ENCRYPTION_PARTS: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionParts"~~
- : WS-Security encryption: defines which parts of the request are encrypted.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_ENCRYPTION_USER
- ~~WS_ENCRYPTION_USER: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionUser"~~
- : WS-Security encryption: the user's name for encryption.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_ENC_PROP_KEYSTORE_ALIAS
- ~~WS_ENC_PROP_KEYSTORE_ALIAS: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystoreAlias"~~
- : WS-Security encryption: the encryption/decryption keystore alias name
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_ENC_PROP_KEYSTORE_PW
- ~~WS_ENC_PROP_KEYSTORE_PW: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystorePassword"~~
- : WS-Security encryption: the encryption/decryption keystore password
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_ENC_PROP_KEYSTORE_TYPE
- ~~WS_ENC_PROP_KEYSTORE_TYPE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystoreType"~~
- : WS-Security encryption: the encryption/decryption keystore type ( jks or pkcs12 ),
default is jks.
**Note:** the keystore file must have the basename of the WSDL file and the
file extension based on the keystore type. For example: MyService.jks.
The keystore file must be placed in the same cartridge directory
as the WSDL file.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_NO_SECURITY
- ~~WS_NO_SECURITY: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "NoSecurity"~~
- : WS-Security action: no security
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_PASSWORD_TYPE
- ~~WS_PASSWORD_TYPE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "passwordType"~~
- : WS-Security password type: parameter for UsernameToken action to define the encoding
of the password. Allowed values are PW\_DIGEST or PW\_TEXT.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_PW_DIGEST
- ~~WS_PW_DIGEST: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PasswordDigest"~~
- : WS-Security password of type digest: use a password digest to send the password information.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_PW_TEXT
- ~~WS_PW_TEXT: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PasswordText"~~
- : WS-Security password of type text: send the password information in clear text.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_SECRETS_MAP
- ~~WS_SECRETS_MAP: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SecretsMap"~~
- : A secrets map with the username/password entries is needed to create the password
callback object.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_SIGNATURE
- ~~WS_SIGNATURE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Signature"~~
- : WS-Security action: sign the message.
The signature-specific parameters define how to sign, which keys
to use, and other parameters.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_SIGNATURE_PARTS
- ~~WS_SIGNATURE_PARTS: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureParts"~~
- : WS-Security signature: defines which parts of the request are signed.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_SIGNATURE_USER
- ~~WS_SIGNATURE_USER: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureUser"~~
- : WS-Security signature: the user's name for signature.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_SIG_DIGEST_ALGO
- ~~WS_SIG_DIGEST_ALGO: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureDigestAlgorithm"~~
- : WS-Security signature: sets the signature digest algorithm to use.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_SIG_PROP_KEYSTORE_ALIAS
- ~~WS_SIG_PROP_KEYSTORE_ALIAS: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystoreAlias"~~
- : WS-Security signature: the signature keystore alias name
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_SIG_PROP_KEYSTORE_PW
- ~~WS_SIG_PROP_KEYSTORE_PW: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystorePassword"~~
- : WS-Security signature: the signature keystore password.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_SIG_PROP_KEYSTORE_TYPE
- ~~WS_SIG_PROP_KEYSTORE_TYPE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystoreType"~~
- : WS-Security: the signature keystore type ( jks or pkcs12 ). The default is jks.
**Note:** The keystore file must have the basename of the WSDL file and the
file extension of the keystore type. For example: MyService.jks.
The keystore file must be placed in the same cartridge directory
as the WSDL file.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_TIMESTAMP
- ~~WS_TIMESTAMP: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Timestamp"~~
- : WS-Security action: add a timestamp to the security header.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_USER
- ~~WS_USER: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "user"~~
- : WS-Security user name.
**Deprecated:**
**warning:** use webreferences2 instead
---
### WS_USERNAME_TOKEN
- ~~WS_USERNAME_TOKEN: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "UsernameToken"~~
- : WS-Security action: add a UsernameToken identification.
**Deprecated:**
**warning:** use webreferences2 instead
---
## Constructor Details
### SOAPUtil()
- SOAPUtil()
- :
---
## Method Details
### getHTTPRequestHeader(Object, String)
- ~~static getHTTPRequestHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns an HTTP request header property value using the specified key. Null is returned
if the key does not represent an HTTP header property.
**Parameters:**
- svc - a service stub returned from getService().
- key - the header property key.
**Returns:**
- an HTTP request header property value using the specified key or null.
**Deprecated:**
**warning:** use webreferences2 instead
---
### getHTTPResponseHeader(Object, String)
- ~~static getHTTPResponseHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns an HTTP response header property value using the specified key. Null is returned
if the key does not represent an HTTP response header property.
**Parameters:**
- svc - a service stub returned from getService().
- key - the header property key.
**Returns:**
- an HTTP response header property value using the specified key or null.
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHTTPRequestHeader(Object, String, String)
- ~~static setHTTPRequestHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void~~
- : Sets an HTTP request header property using the specified key and value.
**Parameters:**
- svc - a service stub returned from getService().
- key - the header property key.
- value - the header property value. If the value is null, the property identified by the key is removed from the HTTP request header.
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(Object, String)
- ~~static setHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), xml: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void~~
- : Sets a new SOAPHeaderElement in the SOAP request with the namespace of
the XML content.
**Parameters:**
- svc - a service stub returned from getService()
- xml - a string with arbitrary XML content
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(Object, String, Boolean)
- ~~static setHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), xml: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), mustUnderstand: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): void~~
- : Sets a new SOAPHeaderElement in the SOAP request with the namespace of
the XML content.
**Parameters:**
- svc - a service stub returned from getService()
- xml - a string with arbitrary XML content
- mustUnderstand - sets the SOAP header attribute 'mustUnderstand'
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(Object, String, String, Object)
- ~~static setHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), namespace: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), xml: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void~~
- : Creates a new SOAPHeaderElement with the name and namespace and places
the given XML into it.
**Parameters:**
- svc - a service stub returned from getService()
- namespace - the namespace of the header element
- name - the element name for the header element
- xml - a E4X XML object
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(Object, String, String, Object, Boolean)
- ~~static setHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), namespace: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), xml: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), mustUnderstand: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): void~~
- : Creates a new SOAPHeaderElement with the name and namespace and places
the given XML into it.
**Parameters:**
- svc - a service stub returned from getService()
- namespace - the namespace of the header element
- name - the element name for the header element
- xml - a E4X XML object
- mustUnderstand - sets the SOAP header attribute mustUnderstand
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(Object, String, String, Object, Boolean, String)
- ~~static setHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), namespace: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), xml: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), mustUnderstand: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), actor: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void~~
- : Creates a new SOAPHeaderElement with the name and namespace and places
the given XML into it.
```
var usernameToken : XML =
{merchantID}
{merchantPassword}
SOAPUtil.setHeader( service, "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
"Security", usernameToken, true, null
```
**Parameters:**
- svc - a service stub returned from getService()
- namespace - the namespace of the header element
- name - the element name for the header element
- xml - a E4X XML object
- mustUnderstand - sets the SOAP header attribute 'mustUnderstand'
- actor - the SOAP actor, which should be set for this header element. null removes any actor.
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(Object, String, String, String)
- ~~static setHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), namespace: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), xml: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void~~
- : Creates a new SOAPHeaderElement with the name and namespace and places
the given XML into it.
**Parameters:**
- svc - a service stub returned from getService()
- namespace - the namespace of the header element
- name - the element name for the header element
- xml - a string with arbitrary XML content
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(Object, String, String, String, Boolean)
- ~~static setHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), namespace: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), xml: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), mustUnderstand: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): void~~
- : Creates a new SOAPHeaderElement with the name and namespace and places
the given XML into it.
**Parameters:**
- svc - a service stub returned from getService()
- namespace - the namespace of the header element
- name - the element name for the header element
- xml - a string with arbitrary XML content
- mustUnderstand - sets the SOAP header attribute mustUnderstand
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(Object, String, String, String, Boolean, String)
- ~~static setHeader(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), namespace: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), xml: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), mustUnderstand: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), actor: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void~~
- : Creates a new SOAPHeaderElement with the name and namespace and places
the given XML into it.
**Parameters:**
- svc - a service stub returned from getService()
- namespace - the namespace of the header element
- name - the element name for the header element
- xml - a string with arbitrary XML content
- mustUnderstand - sets the SOAP header attribute mustUnderstand
- actor - the SOAP actor, which should be set for this header element. null removes any actor.
**Deprecated:**
**warning:** use webreferences2 instead
---
### setWSSecurityConfig(Object, Object, Object)
- ~~static setWSSecurityConfig(svc: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), requestConfigMap: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), responseConfigMap: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void~~
- : Sets the WS-Security configuration for the request and response based on the
constants defined.
**Parameters:**
- svc - a service stub returned from getService()
- requestConfigMap - the WS-Security request config
- responseConfigMap - the WS-Security response config
**Deprecated:**
**warning:** use webreferences2 instead
---
# Class SortedMap
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.util.Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md)
- [dw.util.SortedMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md)
A map that further guarantees that it will be in ascending key order,
sorted according to the natural ordering of its keys,
or by a comparator provided at sorted map creation time. This order is reflected
when iterating over the sorted map's collection views (returned by the entrySet,
keySet and values methods).
Note that sorting by natural order is only supported for Number,
String, Date, Money and Quantity as key.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [SortedMap](#sortedmap)() | Constructor to create a new SortedMap. |
| [SortedMap](#sortedmapobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Constructor to create a new SortedMap. |
## Method Summary
| Method | Description |
| --- | --- |
| [clone](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md#clone)() | Returns a shallow copy of this map. |
| [firstKey](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md#firstkey)() | Returns the first (lowest) key currently in this sorted map. |
| [headMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md#headmapobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns a view of the portion of this map whose keys are strictly less than toKey. |
| [lastKey](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md#lastkey)() | Returns the last (highest) key currently in this sorted map. |
| [subMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md#submapobject-object)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. |
| [tailMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md#tailmapobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns a view of the portion of this map whose keys are greater than or equal to fromKey. |
### Methods inherited from class Map
[clear](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#clear), [containsKey](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#containskeyobject), [containsValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#containsvalueobject), [entrySet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#entryset), [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#getobject), [getLength](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#getlength), [isEmpty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#isempty), [keySet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#keyset), [put](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#putobject-object), [putAll](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#putallmap), [remove](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#removeobject), [size](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#size), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#values---variant-1), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md#values---variant-2)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### SortedMap()
- SortedMap()
- : Constructor to create a new SortedMap.
---
### SortedMap(Object)
- SortedMap(comparator: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Constructor to create a new SortedMap.
The constructor takes a compare function as additional parameter. This comparator
determines identity and the order of the element keys for this map.
The order of the elements is determined with a comparator (see [PropertyComparator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.PropertyComparator.md))
or with the help of the given function. The function must take two parameters
and return a value <=-1 if the first parameter is smaller than the second,
a value if >=1 if the first one is greater than the second parameter
and a value in between like 0 if both are equal.
**Parameters:**
- comparator - an instance of a PropertyComparator or a comparison function
---
## Method Details
### clone()
- clone(): [SortedMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md)
- : Returns a shallow copy of this map.
**Returns:**
- a shallow copy of this map.
---
### firstKey()
- firstKey(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the first (lowest) key currently in this sorted map.
**Returns:**
- the first (lowest) key currently in this sorted map.
---
### headMap(Object)
- headMap(key: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [SortedMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md)
- : Returns a view of the portion of this map whose keys are strictly less than toKey.
**Parameters:**
- key - high endpoint (exclusive) of the headMap.
**Returns:**
- a view of the portion of this map whose keys are strictly less than toKey.
---
### lastKey()
- lastKey(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the last (highest) key currently in this sorted map.
**Returns:**
- the last (highest) key currently in this sorted map.
---
### subMap(Object, Object)
- subMap(from: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), to: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [SortedMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md)
- : Returns a view of the portion of this map whose keys range from fromKey, inclusive,
to toKey, exclusive. (If fromKey and toKey are equal, the returned sorted map is empty.)
**Parameters:**
- from - low endpoint (inclusive) of the subMap.
- to - high endpoint (exclusive) of the subMap.
**Returns:**
- a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
---
### tailMap(Object)
- tailMap(key: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [SortedMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedMap.md)
- : Returns a view of the portion of this map whose keys are greater than or equal
to fromKey. The returned sorted map is backed by this map, so changes in the
returned sorted map are reflected in this map, and vice-versa. The returned
sorted map supports all optional map operations.
**Parameters:**
- key - low endpoint (inclusive) of the tailMap.
**Returns:**
- a view of the portion of this map whose keys are greater than or equal to fromKey.
---
# Class SortedSet
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.util.Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- [dw.util.Set](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Set.md)
- [dw.util.SortedSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md)
A set that further guarantees that its iterator
will traverse the set in ascending element order,
sorted according to the natural ordering of its
elements (only supported for Number, String,
Date, Money and Quantity), or by a comparator
provided at sorted set creation time.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [SortedSet](#sortedset)() | Constructor to create a new SortedSet. |
| [SortedSet](#sortedsetobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Constructor to create a new SortedSet. |
| [SortedSet](#sortedsetcollection)([Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)) | Constructor for a new SortedSet. |
## Method Summary
| Method | Description |
| --- | --- |
| [clone](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md#clone)() | Returns a shallow copy of this set. |
| [first](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md#first)() | Returns the first (lowest) element currently in this sorted set. |
| [headSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md#headsetobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns a view of the portion of this sorted set whose elements are strictly less than toElement. |
| [last](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md#last)() | Returns the last (highest) element currently in this sorted set. |
| [subSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md#subsetobject-object)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns a view of the portion of this sorted set whose elements range from fromElement, inclusive, to toElement, exclusive. |
| [tailSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md#tailsetobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns a view of the portion of this sorted set whose elements are greater than or equal to fromElement. |
### Methods inherited from class Collection
[add](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#addobject), [add1](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#add1object), [addAll](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#addallcollection), [clear](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#clear), [contains](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#containsobject), [containsAll](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#containsallcollection), [getLength](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#getlength), [isEmpty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#isempty), [iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#iterator), [remove](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#removeobject), [removeAll](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#removeallcollection), [retainAll](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#retainallcollection), [size](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#size), [toArray](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#toarray), [toArray](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md#toarraynumber-number)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### SortedSet()
- SortedSet()
- : Constructor to create a new SortedSet.
---
### SortedSet(Object)
- SortedSet(comparator: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Constructor to create a new SortedSet.
The constructor takes a compare function as additional parameter. This comparator
determines identity and the order of the elements for this set.
The order of the elements is determined with a comparator (see [PropertyComparator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.PropertyComparator.md))
or with the help of the given function. The function must take two parameters
and return a value <=-1 if the first parameter is smaller than the second,
a value if >=1 if the first one is greater than the second parameter
and a value in between like 0 if both are equal.
**Parameters:**
- comparator - an instance of a PropertyComparator or a comparison function
---
### SortedSet(Collection)
- SortedSet(collection: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md))
- : Constructor for a new SortedSet. The constructor
initializes the SortedSet with the elements of the
given collection.
**Parameters:**
- collection - the collection of objects that are inserted into the set.
---
## Method Details
### clone()
- clone(): [SortedSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md)
- : Returns a shallow copy of this set.
**Returns:**
- a shallow copy of this set.
---
### first()
- first(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the first (lowest) element currently in this sorted set.
**Returns:**
- the first (lowest) element currently in this sorted set.
---
### headSet(Object)
- headSet(key: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [SortedSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md)
- : Returns a view of the portion of this sorted set whose elements
are strictly less than toElement. The returned sorted set is
backed by this sorted set, so changes in the returned sorted
set are reflected in this sorted set, and vice-versa. The returned
sorted set supports all optional set operations.
**Parameters:**
- key - high endpoint (exclusive) of the headSet.
**Returns:**
- a view of the specified initial range of this sorted set.
---
### last()
- last(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the last (highest) element currently in this sorted set.
**Returns:**
- the last (highest) element currently in this sorted set.
---
### subSet(Object, Object)
- subSet(from: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), to: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [SortedSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md)
- : Returns a view of the portion of this sorted set whose elements
range from fromElement, inclusive, to toElement, exclusive. (If
fromElement and toElement are equal, the returned sorted set is empty.)
The returned sorted set is backed by this sorted set, so changes in
the returned sorted set are reflected in this sorted set, and vice-versa.
The returned sorted set supports all optional set operations that this
sorted set supports.
**Parameters:**
- from - low endpoint (inclusive) of the subSet.
- to - high endpoint (exclusive) of the subSet.
**Returns:**
- a view of the specified range within this sorted set.
---
### tailSet(Object)
- tailSet(key: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [SortedSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SortedSet.md)
- : Returns a view of the portion of this sorted set whose elements
are greater than or equal to fromElement. The returned sorted set
is backed by this sorted set, so changes in the returned sorted
set are reflected in this sorted set, and vice-versa. The returned
sorted set supports all optional set operations.
**Parameters:**
- key - low endpoint (inclusive) of the tailSet.
**Returns:**
- a view of the specified final range of this sorted set.
---
# Class SortingOption
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- [dw.catalog.SortingOption](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingOption.md)
Represents an option for how to sort products in storefront search results.
## Property Summary
| Property | Description |
| --- | --- |
| [ID](#id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the sorting option. |
| [description](#description): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the description of the sorting option for the current locale. |
| [displayName](#displayname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the display name of the of the sorting option for the current locale. |
| [sortingRule](#sortingrule): [SortingRule](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingRule.md) `(read-only)` | Returns the sorting rule for this sorting option, or `null` if there is no associated rule. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingOption.md#getdescription)() | Returns the description of the sorting option for the current locale. |
| [getDisplayName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingOption.md#getdisplayname)() | Returns the display name of the of the sorting option for the current locale. |
| [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingOption.md#getid)() | Returns the ID of the sorting option. |
| [getSortingRule](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingOption.md#getsortingrule)() | Returns the sorting rule for this sorting option, or `null` if there is no associated rule. |
### Methods inherited from class PersistentObject
[getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### ID
- ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the sorting option.
---
### description
- description: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the description of the sorting option for the current locale.
---
### displayName
- displayName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the display name of the of the sorting option for the current locale.
---
### sortingRule
- sortingRule: [SortingRule](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingRule.md) `(read-only)`
- : Returns the sorting rule for this sorting option,
or `null` if there is no associated rule.
---
## Method Details
### getDescription()
- getDescription(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the description of the sorting option for the current locale.
**Returns:**
- The value of the property for the current locale, or null if it
wasn't found.
---
### getDisplayName()
- getDisplayName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the display name of the of the sorting option for the current locale.
**Returns:**
- The value of the property for the current locale, or null if it
wasn't found.
---
### getID()
- getID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the sorting option.
**Returns:**
- sorting option ID
---
### getSortingRule()
- getSortingRule(): [SortingRule](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingRule.md)
- : Returns the sorting rule for this sorting option,
or `null` if there is no associated rule.
**Returns:**
- a ProductSortingRule instance representing the rule
for this option or null.
---
# Class SortingRule
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- [dw.catalog.SortingRule](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingRule.md)
Represents a product sorting rule for use with the [ProductSearchModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchModel.md).
## Property Summary
| Property | Description |
| --- | --- |
| [ID](#id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the sorting rule. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingRule.md#getid)() | Returns the ID of the sorting rule. |
### Methods inherited from class PersistentObject
[getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### ID
- ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the sorting rule.
---
## Method Details
### getID()
- getID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the sorting rule.
**Returns:**
- sorting rule ID
---
# Class SourceCodeGroup
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- [dw.object.ExtensibleObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md)
- [dw.campaign.SourceCodeGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeGroup.md)
A source code group defines a collection of source codes. Source code groups
are generally pattern based and any source code satisfying the pattern
belongs to the group. In this way, merchants may define a large set of source
codes which qualify a customer for site experiences (different prices, for
example), which customers without that source code do not receive.
The class [SourceCodeInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeInfo.md) represents an individual source
code.
## Property Summary
| Property | Description |
| --- | --- |
| [ID](#id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | The ID of the SourceCodeGroup. |
| [priceBooks](#pricebooks): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns a Collection of PriceBooks the SourceCodeGroup is assigned to. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeGroup.md#getid)() | The ID of the SourceCodeGroup. |
| [getPriceBooks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeGroup.md#getpricebooks)() | Returns a Collection of PriceBooks the SourceCodeGroup is assigned to. |
### Methods inherited from class ExtensibleObject
[describe](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#describe), [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#getcustom)
### Methods inherited from class PersistentObject
[getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### ID
- ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : The ID of the SourceCodeGroup.
---
### priceBooks
- priceBooks: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns a Collection of PriceBooks the SourceCodeGroup is assigned to.
---
## Method Details
### getID()
- getID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The ID of the SourceCodeGroup.
**Returns:**
- the ID.
---
### getPriceBooks()
- getPriceBooks(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns a Collection of PriceBooks the SourceCodeGroup is assigned to.
**Returns:**
- Collection of PriceBooks the SourceCodeGroup is assigned to.
---
# Class SourceCodeInfo
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.campaign.SourceCodeInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeInfo.md)
Class representing a code (i.e. a "source code") that has been applied to a
customer's session. Source codes can qualify customers for different
campaigns, promotions, and other site experiences from those that the typical
customer sees. Codes are organized into source code groups.
Typically, a code is applied to a customer's session automatically by
Commerce Cloud Digital when a customer accesses a Digital URL with a well
known request parameter in the querystring. A code may also be explicitly
applied to a customer session using the `SetSourceCode`
pipelet.
## Constant Summary
| Constant | Description |
| --- | --- |
| [STATUS_ACTIVE](#status_active): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2 | The literal source-code is found and currently active. |
| [STATUS_INACTIVE](#status_inactive): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | The literal source-code is found but not active. |
| [STATUS_INVALID](#status_invalid): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0 | The literal source-code is not found in the system. |
## Property Summary
| Property | Description |
| --- | --- |
| [code](#code): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | The literal source-code. |
| [group](#group): [SourceCodeGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeGroup.md) `(read-only)` | The associated source-code group. |
| [redirect](#redirect): [URLRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md) `(read-only)` | Retrieves the redirect information from the last processed SourceCodeGroup (active or inactive). |
| [status](#status): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | The status of the source-code. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeInfo.md#getcode)() | The literal source-code. |
| [getGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeInfo.md#getgroup)() | The associated source-code group. |
| [getRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeInfo.md#getredirect)() | Retrieves the redirect information from the last processed SourceCodeGroup (active or inactive). |
| [getStatus](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeInfo.md#getstatus)() | The status of the source-code. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### STATUS_ACTIVE
- STATUS_ACTIVE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2
- : The literal source-code is found and currently active.
---
### STATUS_INACTIVE
- STATUS_INACTIVE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : The literal source-code is found but not active.
---
### STATUS_INVALID
- STATUS_INVALID: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0
- : The literal source-code is not found in the system.
---
## Property Details
### code
- code: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : The literal source-code.
---
### group
- group: [SourceCodeGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeGroup.md) `(read-only)`
- : The associated source-code group.
---
### redirect
- redirect: [URLRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md) `(read-only)`
- : Retrieves the redirect information from the last processed SourceCodeGroup (active or inactive). If none exists,
then the redirect information is retrieved from the source-code preferences, based on the active/inactive status
of the SourceCodeGroup. The redirect information is then resolved to the output URL. If the redirect information
cannot be resolved to a URL, or there is an error retrieving the preferences, then null is returned.
---
### status
- status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : The status of the source-code. One of the following:
STATUS\_INVALID - The source code is not found in the system.
STATUS\_INACTIVE - The source code is found but not active.
STATUS\_INACTIVE - The source code is found and active.
---
## Method Details
### getCode()
- getCode(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The literal source-code.
**Returns:**
- the source-code.
---
### getGroup()
- getGroup(): [SourceCodeGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeGroup.md)
- : The associated source-code group.
**Returns:**
- the source-code group.
---
### getRedirect()
- getRedirect(): [URLRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md)
- : Retrieves the redirect information from the last processed SourceCodeGroup (active or inactive). If none exists,
then the redirect information is retrieved from the source-code preferences, based on the active/inactive status
of the SourceCodeGroup. The redirect information is then resolved to the output URL. If the redirect information
cannot be resolved to a URL, or there is an error retrieving the preferences, then null is returned.
**Returns:**
- URLRedirect containing the location and status code, null in case of no redirect was found
---
### getStatus()
- getStatus(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The status of the source-code. One of the following:
STATUS\_INVALID - The source code is not found in the system.
STATUS\_INACTIVE - The source code is found but not active.
STATUS\_INACTIVE - The source code is found and active.
**Returns:**
- the status.
---
# Class SourceCodeStatusCodes
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.campaign.SourceCodeStatusCodes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.SourceCodeStatusCodes.md)
Helper class which contains error result codes returned by the SetSourceCode
pipelet.
## Constant Summary
| Constant | Description |
| --- | --- |
| [CODE_INACTIVE](#code_inactive): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "CODE_INACTIVE" | Indicates that the specified source code was found in one or more source-code groups, none of which are active. |
| [CODE_INVALID](#code_invalid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "CODE_INVALID" | Indicates that the specified source code is not contained in any source-code group. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [SourceCodeStatusCodes](#sourcecodestatuscodes)() | |
## Method Summary
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### CODE_INACTIVE
- CODE_INACTIVE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "CODE_INACTIVE"
- : Indicates that the specified source code was found in one or more
source-code groups, none of which are active.
---
### CODE_INVALID
- CODE_INVALID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "CODE_INVALID"
- : Indicates that the specified source code is not contained
in any source-code group.
---
## Constructor Details
### SourceCodeStatusCodes()
- SourceCodeStatusCodes()
- :
---
# Class Status
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.system.Status](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md)
A Status is used for communicating an API status code back to a client. A status
consists of multiple StatusItem. Most often a Status contains only one StatusItem.
For convenience, a message with parameters is formatted using standard
formatting patterns. If you want to display locale-specific messages in your
application, you should use the Status.getCode() as key for a resource bundle.
## Property Summary
| Property | Description |
| --- | --- |
| [ERROR](#error): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | status value to indicate an ERROR status |
| [OK](#ok): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | status value to indicate an OK status |
| [code](#code): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the status code either of the first ERROR StatusItem or when there is no ERROR StatusITEM, the first StatusItem in the overall list. |
| [details](#details): [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)` | Returns the details either of the first ERROR StatusItem or when there is no ERROR StatusItem, the first StatusItem in the overall list. |
| [error](#error): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Checks if the status is an ERROR. |
| [items](#items): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)` | Returns all status items. |
| [message](#message): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the message either of the first ERROR StatusItem or when there is no ERROR StatusItem, the first StatusItem in the overall list. |
| [parameters](#parameters): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)` | Returns the parameters either of the first ERROR StatusItem or when there is no ERROR StatusItem, the first StatusItem in the overall list. |
| [status](#status): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the overall status. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Status](#status)() | Creates a Status object with no StatusItems. |
| [Status](#statusnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates a Status with a single StatusItem. |
| [Status](#statusnumber-string)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a Status with a single StatusItem. |
| [Status](#statusnumber-string-string-object)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Creates a Status with a single StatusItem. |
## Method Summary
| Method | Description |
| --- | --- |
| [addDetail](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#adddetailstring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Add detail information for the given key of the first ERROR StatusItem or when there is no ERROR StatusItem, the first StatusItem in the overall list. |
| [addItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#additemstatusitem)([StatusItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md)) | Adds an additional status item to this status instance. |
| [getCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#getcode)() | Returns the status code either of the first ERROR StatusItem or when there is no ERROR StatusITEM, the first StatusItem in the overall list. |
| [getDetail](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#getdetailstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the detail value for the given key of the first ERROR StatusItem or when there is no ERROR StatusItem, the first StatusItem in the overall list. |
| [getDetails](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#getdetails)() | Returns the details either of the first ERROR StatusItem or when there is no ERROR StatusItem, the first StatusItem in the overall list. |
| [getItems](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#getitems)() | Returns all status items. |
| [getMessage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#getmessage)() | Returns the message either of the first ERROR StatusItem or when there is no ERROR StatusItem, the first StatusItem in the overall list. |
| [getParameters](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#getparameters)() | Returns the parameters either of the first ERROR StatusItem or when there is no ERROR StatusItem, the first StatusItem in the overall list. |
| [getStatus](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#getstatus)() | Returns the overall status. |
| [isError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#iserror)() | Checks if the status is an ERROR. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### ERROR
- ERROR: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : status value to indicate an ERROR status
---
### OK
- OK: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : status value to indicate an OK status
---
### code
- code: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the status code either of the first ERROR StatusItem or when there
is no ERROR StatusITEM, the first StatusItem in the overall list.
The status code is the unique identifier for the message and can be used by
client programs to check for a specific status and to generate a localized
message.
---
### details
- details: [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)`
- : Returns the details either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
---
### error
- error: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Checks if the status is an ERROR. The Status is an ERROR if one of the
contained StatusItems is an ERROR.
---
### items
- items: [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)`
- : Returns all status items.
---
### message
- message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the message either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
Note: Custom code and client programs must not use this message to identify
a specific status. The getCode() must be used for that purpose. The actual
message can change from release to release.
---
### parameters
- parameters: [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)`
- : Returns the parameters either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
---
### status
- status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the overall status. If all StatusItems are OK, the method returns
OK. If one StatusItem is an ERROR it returns ERROR.
---
## Constructor Details
### Status()
- Status()
- : Creates a Status object with no StatusItems.
---
### Status(Number)
- Status(status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates a Status with a single StatusItem. The status is set to the given
value.
**Parameters:**
- status - either OK or ERROR
---
### Status(Number, String)
- Status(status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), code: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Creates a Status with a single StatusItem. The StatusItem is initialized
with the given values.
**Parameters:**
- status - either OK or ERROR
- code - a string representing a more detailed status code, e.g. "IMPEX-120"
---
### Status(Number, String, String, Object...)
- Status(status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), code: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), parameters: [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Creates a Status with a single StatusItem. The StatusItem is initialized
with the given values.
**Parameters:**
- status - either OK or ERROR
- code - a string representing a more detailed status code, e.g. "IMPEX-120".
- message - a default human readable message
- parameters - a list of parameters to construct a custom message
---
## Method Details
### addDetail(String, Object)
- addDetail(key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Add detail information for the given key of the first ERROR StatusItem
or when there is no ERROR StatusItem, the first StatusItem in the overall list.
**Parameters:**
- key - the key of the first ERROR StatusItem or the first StatusItem in the list.
- value - the detail value.
---
### addItem(StatusItem)
- addItem(item: [StatusItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md)): void
- : Adds an additional status item to this status instance.
**Parameters:**
- item - the status item to add.
---
### getCode()
- getCode(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the status code either of the first ERROR StatusItem or when there
is no ERROR StatusITEM, the first StatusItem in the overall list.
The status code is the unique identifier for the message and can be used by
client programs to check for a specific status and to generate a localized
message.
**Returns:**
- the status code
---
### getDetail(String)
- getDetail(key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the detail value for the given key of the first ERROR StatusItem
or when there is no ERROR StatusItem, the first StatusItem in the
overall list.
**Parameters:**
- key - the key for the detail to return.
**Returns:**
- the detail value for the given key of the first ERROR StatusItem
or when there is no ERROR StatusItem, the first StatusItem in the
overall list.
---
### getDetails()
- getDetails(): [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md)
- : Returns the details either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
**Returns:**
- the details either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
---
### getItems()
- getItems(): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
- : Returns all status items.
**Returns:**
- all status items.
---
### getMessage()
- getMessage(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the message either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
Note: Custom code and client programs must not use this message to identify
a specific status. The getCode() must be used for that purpose. The actual
message can change from release to release.
**Returns:**
- the message either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
---
### getParameters()
- getParameters(): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
- : Returns the parameters either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
**Returns:**
- the parameters either of the first ERROR StatusItem or when there
is no ERROR StatusItem, the first StatusItem in the overall list.
---
### getStatus()
- getStatus(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the overall status. If all StatusItems are OK, the method returns
OK. If one StatusItem is an ERROR it returns ERROR.
**Returns:**
- either OK or ERROR
---
### isError()
- isError(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Checks if the status is an ERROR. The Status is an ERROR if one of the
contained StatusItems is an ERROR.
**Returns:**
- true if status is an ERROR, false otherwise.
---
# Class StatusItem
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.system.StatusItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md)
A StatusItem holds all the status information. Multi StatusItems are bundled
together into a Status.
## Property Summary
| Property | Description |
| --- | --- |
| [code](#code): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message. |
| [details](#details): [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)` | Returns the optional details for this StatusItem. |
| [error](#error): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns whether this Status Item represents and error. |
| [message](#message): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Returns the default human readable message for this Status. |
| [parameters](#parameters): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) | Returns the parameters to construct a custom message. |
| [status](#status): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | Returns the status. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [StatusItem](#statusitem)() | Constructs a new OK StatusItem. |
| [StatusItem](#statusitemnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Constructs a new StatusItem with the given status. |
| [StatusItem](#statusitemnumber-string)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs a new StatusItem with the given status and code. |
| [StatusItem](#statusitemnumber-string-string-object)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Constructs a new StatusItem with the given values. |
## Method Summary
| Method | Description |
| --- | --- |
| [addDetail](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#adddetailstring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Add an additional detail to this StatusItem. |
| [getCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#getcode)() | The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message. |
| [getDetails](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#getdetails)() | Returns the optional details for this StatusItem. |
| [getMessage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#getmessage)() | Returns the default human readable message for this Status. |
| [getParameters](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#getparameters)() | Returns the parameters to construct a custom message. |
| [getStatus](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#getstatus)() | Returns the status. |
| [isError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#iserror)() | Returns whether this Status Item represents and error. |
| [setCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#setcodestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Method to set the status code. |
| [setMessage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#setmessagestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets the default human readable message for this Status. |
| [setParameters](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#setparametersobject)([Object\[\]](TopLevel.Object.md)) | Sets the parameters for a custom message. |
| [setStatus](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.StatusItem.md#setstatusnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Set the status. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### code
- code: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The status code is the unique identifier for the message and can be used by
client programs to check for a specific status and to generate a localized
message.
---
### details
- details: [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)`
- : Returns the optional details for this StatusItem.
---
### error
- error: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns whether this Status Item represents and error.
---
### message
- message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the default human readable message for this Status.
Note: Custom code and client programs must not use this message to identify
a specific status. The getCode() must be used for that purpose. The actual
message can change from release to release.
---
### parameters
- parameters: [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
- : Returns the parameters to construct a custom message.
---
### status
- status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the status.
---
## Constructor Details
### StatusItem()
- StatusItem()
- : Constructs a new OK StatusItem.
---
### StatusItem(Number)
- StatusItem(status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Constructs a new StatusItem with the given status.
**Parameters:**
- status - either [Status.OK](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#ok) or [Status.ERROR](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#error).
---
### StatusItem(Number, String)
- StatusItem(status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), code: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs a new StatusItem with the given status and code.
**Parameters:**
- status - either [Status.OK](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#ok) or [Status.ERROR](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#error).
- code - a string representing a more detailed status code, e.g. "IMPEX-120".
---
### StatusItem(Number, String, String, Object...)
- StatusItem(status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), code: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), parameters: [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Constructs a new StatusItem with the given values.
**Parameters:**
- status - [Status.OK](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#ok) or [Status.ERROR](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#error).
- code - a string representing a more detailed status code, e.g. "IMPEX-120".
- message - a default human readable message
- parameters - a list of parameters to construct a custom message
---
## Method Details
### addDetail(String, Object)
- addDetail(key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Add an additional detail to this StatusItem.
**Parameters:**
- key - the key for the detail.
- value - the detail value.
---
### getCode()
- getCode(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The status code is the unique identifier for the message and can be used by
client programs to check for a specific status and to generate a localized
message.
**Returns:**
- the status code.
---
### getDetails()
- getDetails(): [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md)
- : Returns the optional details for this StatusItem.
**Returns:**
- the optional details for this StatusItem.
---
### getMessage()
- getMessage(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the default human readable message for this Status.
Note: Custom code and client programs must not use this message to identify
a specific status. The getCode() must be used for that purpose. The actual
message can change from release to release.
**Returns:**
- the default human readable message for this Status.
---
### getParameters()
- getParameters(): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
- : Returns the parameters to construct a custom message.
**Returns:**
- the parameters to construct a custom message.
---
### getStatus()
- getStatus(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the status.
**Returns:**
- either [Status.OK](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#ok) or
[Status.ERROR](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#error).
---
### isError()
- isError(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns whether this Status Item represents and error.
**Returns:**
- true is this item represents an error, false otherwise.
---
### setCode(String)
- setCode(code: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Method to set the status code.
The status code is the unique identifier for the message and can be used by
client programs to check for a specific status and to generate a localized
message.
**Parameters:**
- code - the status code.
---
### setMessage(String)
- setMessage(message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Sets the default human readable message for this Status.
**Parameters:**
- message - the default human readable message for this Status.
---
### setParameters(Object[])
- setParameters(parameters: [Object\[\]](TopLevel.Object.md)): void
- : Sets the parameters for a custom message.
**Parameters:**
- parameters - the parameters for a custom message.
---
### setStatus(Number)
- setStatus(status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void
- : Set the status.
**Parameters:**
- status - either [Status.OK](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#ok) or [Status.ERROR](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md#error).
---
# Class StopIteration
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.StopIteration](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.StopIteration.md)
A special type of exception that is thrown when an Iterator or Generator
sequence is exhausted.
**See Also:**
- [Generator.next()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Generator.md#next)
- [Iterator.next()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Iterator.md#next)
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [StopIteration](#stopiteration)() | |
## Method Summary
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### StopIteration()
- StopIteration()
- :
---
# Class Store
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- [dw.object.ExtensibleObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md)
- [dw.catalog.Store](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md)
Represents a store in Commerce Cloud Digital.
## Property Summary
| Property | Description |
| --- | --- |
| [ID](#id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the store. |
| [address1](#address1): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the address1 of the store. |
| [address2](#address2): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the address2 of the store. |
| [city](#city): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the city of the store. |
| [countryCode](#countrycode): [EnumValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.EnumValue.md) `(read-only)` | Returns the countryCode of the store. |
| ~~[demandwarePosEnabled](#demandwareposenabled): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~ `(read-only)` | Returns the demandwarePosEnabled flag for the store. |
| [email](#email): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the email of the store. |
| [fax](#fax): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the fax of the store. |
| [image](#image): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)` | Returns the store image. |
| [inventoryList](#inventorylist): [ProductInventoryList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductInventoryList.md) `(read-only)` | Returns the inventory list the store is associated with. |
| [inventoryListID](#inventorylistid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the inventory list id the store is associated with. |
| [latitude](#latitude): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the latitude of the store. |
| [longitude](#longitude): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the longitude of the store. |
| [name](#name): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the name of the store. |
| [phone](#phone): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the phone of the store. |
| [posEnabled](#posenabled): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns the posEnabled flag for the Store. |
| [postalCode](#postalcode): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the postalCode of the store. |
| [stateCode](#statecode): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the stateCode of the store. |
| [storeEvents](#storeevents): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)` | Returns the storeEvents of the store. |
| [storeGroups](#storegroups): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns all the store groups this store belongs to. |
| [storeHours](#storehours): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)` | Returns the storeHours of the store. |
| [storeLocatorEnabled](#storelocatorenabled): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns the storeLocatorEnabled flag for the store. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getAddress1](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getaddress1)() | Returns the address1 of the store. |
| [getAddress2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getaddress2)() | Returns the address2 of the store. |
| [getCity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getcity)() | Returns the city of the store. |
| [getCountryCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getcountrycode)() | Returns the countryCode of the store. |
| [getEmail](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getemail)() | Returns the email of the store. |
| [getFax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getfax)() | Returns the fax of the store. |
| [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getid)() | Returns the ID of the store. |
| [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getimage)() | Returns the store image. |
| [getInventoryList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getinventorylist)() | Returns the inventory list the store is associated with. |
| [getInventoryListID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getinventorylistid)() | Returns the inventory list id the store is associated with. |
| [getLatitude](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getlatitude)() | Returns the latitude of the store. |
| [getLongitude](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getlongitude)() | Returns the longitude of the store. |
| [getName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getname)() | Returns the name of the store. |
| [getPhone](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getphone)() | Returns the phone of the store. |
| [getPostalCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getpostalcode)() | Returns the postalCode of the store. |
| [getStateCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getstatecode)() | Returns the stateCode of the store. |
| [getStoreEvents](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getstoreevents)() | Returns the storeEvents of the store. |
| [getStoreGroups](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getstoregroups)() | Returns all the store groups this store belongs to. |
| [getStoreHours](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getstorehours)() | Returns the storeHours of the store. |
| ~~[isDemandwarePosEnabled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#isdemandwareposenabled)()~~ | Returns the demandwarePosEnabled flag for the store. |
| [isPosEnabled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#isposenabled)() | Returns the posEnabled flag for the Store. |
| [isStoreLocatorEnabled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#isstorelocatorenabled)() | Returns the storeLocatorEnabled flag for the store. |
### Methods inherited from class ExtensibleObject
[describe](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#describe), [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#getcustom)
### Methods inherited from class PersistentObject
[getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### ID
- ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the store.
---
### address1
- address1: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the address1 of the store.
---
### address2
- address2: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the address2 of the store.
---
### city
- city: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the city of the store.
---
### countryCode
- countryCode: [EnumValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.EnumValue.md) `(read-only)`
- : Returns the countryCode of the store.
---
### demandwarePosEnabled
- ~~demandwarePosEnabled: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~ `(read-only)`
- : Returns the demandwarePosEnabled flag for the store.
Indicates that this store uses Commerce Cloud Store for point-of-sale.
**Deprecated:**
**warning:** Use [isPosEnabled()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#isposenabled) instead
---
### email
- email: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the email of the store.
---
### fax
- fax: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the fax of the store.
---
### image
- image: [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)`
- : Returns the store image.
---
### inventoryList
- inventoryList: [ProductInventoryList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductInventoryList.md) `(read-only)`
- : Returns the inventory list the store is associated with. If the
store is not associated with a inventory list, or the inventory list does not
exist, the method returns null.
---
### inventoryListID
- inventoryListID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the inventory list id the store is associated with. If the
store is not associated with a inventory list, or the inventory list does not
exist, the method returns null.
---
### latitude
- latitude: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the latitude of the store.
---
### longitude
- longitude: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the longitude of the store.
---
### name
- name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the name of the store.
---
### phone
- phone: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the phone of the store.
---
### posEnabled
- posEnabled: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns the posEnabled flag for the Store.
Indicates that this store uses Commerce Cloud Store for point-of-sale.
---
### postalCode
- postalCode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the postalCode of the store.
---
### stateCode
- stateCode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the stateCode of the store.
---
### storeEvents
- storeEvents: [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`
- : Returns the storeEvents of the store.
---
### storeGroups
- storeGroups: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns all the store groups this store belongs to.
---
### storeHours
- storeHours: [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`
- : Returns the storeHours of the store.
---
### storeLocatorEnabled
- storeLocatorEnabled: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns the storeLocatorEnabled flag for the store.
---
## Method Details
### getAddress1()
- getAddress1(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the address1 of the store.
**Returns:**
- address1 of the store
---
### getAddress2()
- getAddress2(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the address2 of the store.
**Returns:**
- address2 of the store
---
### getCity()
- getCity(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the city of the store.
**Returns:**
- city of the store
---
### getCountryCode()
- getCountryCode(): [EnumValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.EnumValue.md)
- : Returns the countryCode of the store.
**Returns:**
- countryCode of the store
---
### getEmail()
- getEmail(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the email of the store.
**Returns:**
- email of the store
---
### getFax()
- getFax(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the fax of the store.
**Returns:**
- fax of the store
---
### getID()
- getID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the store.
**Returns:**
- ID of the store
---
### getImage()
- getImage(): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md)
- : Returns the store image.
**Returns:**
- the store image.
---
### getInventoryList()
- getInventoryList(): [ProductInventoryList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductInventoryList.md)
- : Returns the inventory list the store is associated with. If the
store is not associated with a inventory list, or the inventory list does not
exist, the method returns null.
**Returns:**
- ProductInventoryList or null
---
### getInventoryListID()
- getInventoryListID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the inventory list id the store is associated with. If the
store is not associated with a inventory list, or the inventory list does not
exist, the method returns null.
**Returns:**
- the inventory list id
---
### getLatitude()
- getLatitude(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the latitude of the store.
**Returns:**
- latitude of the store
---
### getLongitude()
- getLongitude(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the longitude of the store.
**Returns:**
- longitude of the store
---
### getName()
- getName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the name of the store.
**Returns:**
- name of the store
---
### getPhone()
- getPhone(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the phone of the store.
**Returns:**
- phone of the store
---
### getPostalCode()
- getPostalCode(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the postalCode of the store.
**Returns:**
- postalCode of the store
---
### getStateCode()
- getStateCode(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the stateCode of the store.
**Returns:**
- stateCode of the store
---
### getStoreEvents()
- getStoreEvents(): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md)
- : Returns the storeEvents of the store.
**Returns:**
- storeEvents of the store
---
### getStoreGroups()
- getStoreGroups(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all the store groups this store belongs to.
**Returns:**
- collection of store groups
---
### getStoreHours()
- getStoreHours(): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md)
- : Returns the storeHours of the store.
**Returns:**
- storeHours of the store
---
### isDemandwarePosEnabled()
- ~~isDemandwarePosEnabled(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~
- : Returns the demandwarePosEnabled flag for the store.
Indicates that this store uses Commerce Cloud Store for point-of-sale.
**Returns:**
- the demandwarePosEnabled flag
**Deprecated:**
**warning:** Use [isPosEnabled()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#isposenabled) instead
---
### isPosEnabled()
- isPosEnabled(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns the posEnabled flag for the Store.
Indicates that this store uses Commerce Cloud Store for point-of-sale.
**Returns:**
- the posEnabled flag
---
### isStoreLocatorEnabled()
- isStoreLocatorEnabled(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns the storeLocatorEnabled flag for the store.
**Returns:**
- the storeLocatorEnabled flag
---
# Class StoreGroup
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- [dw.object.ExtensibleObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md)
- [dw.catalog.StoreGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreGroup.md)
Represents a store group. Store groups can be used to group the stores for different marketing purposes.
## Property Summary
| Property | Description |
| --- | --- |
| [ID](#id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the store group. |
| [name](#name): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the name of the store group. |
| [stores](#stores): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns all the stores that are assigned to the store group. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreGroup.md#getid)() | Returns the ID of the store group. |
| [getName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreGroup.md#getname)() | Returns the name of the store group. |
| [getStores](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreGroup.md#getstores)() | Returns all the stores that are assigned to the store group. |
### Methods inherited from class ExtensibleObject
[describe](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#describe), [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#getcustom)
### Methods inherited from class PersistentObject
[getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### ID
- ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the store group.
---
### name
- name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the name of the store group.
---
### stores
- stores: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns all the stores that are assigned to the store group.
---
## Method Details
### getID()
- getID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the store group.
**Returns:**
- ID of the store group
---
### getName()
- getName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the name of the store group.
**Returns:**
- name of the store group
---
### getStores()
- getStores(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all the stores that are assigned to the store group.
**Returns:**
- collection of the stores
---
# Class StoreInventoryFilter
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.catalog.StoreInventoryFilter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilter.md)
This class represents a store inventory filter, which can be used at
[ProductSearchModel.setStoreInventoryFilter(StoreInventoryFilter)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchModel.md#setstoreinventoryfilterstoreinventoryfilter) to filter the search result by one or more
store inventories. Compared to the default parameter 'ilids' (Inventory List IDs) see
([ProductSearchModel.INVENTORY_LIST_IDS_PARAMETER](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchModel.md#inventory_list_ids_parameter) the store inventory filter allows a customization of the
parameter name and the inventory list ID parameter values for the URL generations via all URLRefine and URLRelax
methods e.g. for [ProductSearchModel.urlRefineCategory(String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchModel.md#urlrefinecategorystring-string),
[ProductSearchModel.urlRelaxPrice(URL)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchModel.md#urlrelaxpriceurl),
[SearchModel.urlRefineAttribute(String, String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SearchModel.md#urlrefineattributestring-string-string).
Example custom URL: city=Burlington|Boston
```
new dw.catalog.StoreInventoryFilter( "city",
new dw.util.ArrayList( new dw.catalog.StoreInventoryFilterValue( "Burlington", "inventory_store_store9" ),
new dw.catalog.StoreInventoryFilterValue( "Boston", "inventory_store_store8" ) ) );
```
## Property Summary
| Property | Description |
| --- | --- |
| [semanticURLParameter](#semanticurlparameter): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the semantic URL parameter of this StoreInventoryFilter. |
| [storeInventoryFilterValues](#storeinventoryfiltervalues): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)` | Returns a list of [StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md) instances used by this StoreInventoryFilter. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [StoreInventoryFilter](#storeinventoryfilterstring-list)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)) | Creates a new StoreInventoryFilter instance for the given semantic URL parameter and a list of [StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md) instances. |
## Method Summary
| Method | Description |
| --- | --- |
| [getSemanticURLParameter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilter.md#getsemanticurlparameter)() | Returns the semantic URL parameter of this StoreInventoryFilter. |
| [getStoreInventoryFilterValues](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilter.md#getstoreinventoryfiltervalues)() | Returns a list of [StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md) instances used by this StoreInventoryFilter. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### semanticURLParameter
- semanticURLParameter: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the semantic URL parameter of this StoreInventoryFilter.
---
### storeInventoryFilterValues
- storeInventoryFilterValues: [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)`
- : Returns a list of [StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md) instances used by this StoreInventoryFilter.
---
## Constructor Details
### StoreInventoryFilter(String, List)
- StoreInventoryFilter(semanticURLParameter: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), storeFilterValues: [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md))
- : Creates a new StoreInventoryFilter instance for the given semantic URL parameter and a list of
[StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md) instances. The semantic URL parameter e.g. city, zip, store and the semantic
store inventory values from the storeFilterValues will be used for URL generation. The mapped inventory list IDs
from the storeFilterValues will be used for filtering. on the mapped
**Parameters:**
- semanticURLParameter - The semantic URL parameter which should be used for URL generation instead of 'ilids' (Inventory List IDs)
- storeFilterValues - A list of [StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md) instances containing the store inventory values and the related real inventory list ID.
**Throws:**
- NullArgumentException - in case of missing required parameter.
---
## Method Details
### getSemanticURLParameter()
- getSemanticURLParameter(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the semantic URL parameter of this StoreInventoryFilter.
**Returns:**
- the semantic URL parameter of this StoreInventoryFilter.
---
### getStoreInventoryFilterValues()
- getStoreInventoryFilterValues(): [List](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
- : Returns a list of [StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md) instances used by this StoreInventoryFilter.
**Returns:**
- a list of [StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md) instances used by this StoreInventoryFilter.
---
# Class StoreInventoryFilterValue
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.catalog.StoreInventoryFilterValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md)
This class represents a store inventory filter value, which can be used for a [StoreInventoryFilter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilter.md) to filter
the search result by one or more store inventory list IDs via
[ProductSearchModel.setStoreInventoryFilter(StoreInventoryFilter)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchModel.md#setstoreinventoryfilterstoreinventoryfilter). Compared to
[ProductSearchModel.setInventoryListIDs(List)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchModel.md#setinventorylistidslist) the store inventory filter allows a customization of the
inventory parameter name and the inventory list ID values for URL generations. A StoreInventoryFilterValue provides
the mapping between a semantic value e.g. store1,store2 or Burlington,Boston to the related real inventory list ID.
Example custom URL: city=Burlington|Boston
```
new dw.catalog.StoreInventoryFilter("city",
new dw.util.ArrayList(
new dw.catalog.StoreInventoryFilterValue("Burlington","inventory_store_store9"),
new dw.catalog.StoreInventoryFilterValue("Boston","inventory_store_store8")
));
```
## Property Summary
| Property | Description |
| --- | --- |
| [inventoryListID](#inventorylistid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the real inventory list ID of this store inventory filter value. |
| [semanticInventoryID](#semanticinventoryid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the semantic inventory ID of this store inventory filter value. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [StoreInventoryFilterValue](#storeinventoryfiltervaluestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a new StoreInventoryFilterValue instance for the semantic inventory ID and real inventory list ID. |
## Method Summary
| Method | Description |
| --- | --- |
| [getInventoryListID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md#getinventorylistid)() | Returns the real inventory list ID of this store inventory filter value. |
| [getSemanticInventoryID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreInventoryFilterValue.md#getsemanticinventoryid)() | Returns the semantic inventory ID of this store inventory filter value. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### inventoryListID
- inventoryListID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the real inventory list ID of this store inventory filter value.
---
### semanticInventoryID
- semanticInventoryID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the semantic inventory ID of this store inventory filter value.
---
## Constructor Details
### StoreInventoryFilterValue(String, String)
- StoreInventoryFilterValue(semanticInventoryListID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), inventoryListID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- :
Creates a new StoreInventoryFilterValue instance for the semantic inventory ID and real inventory list ID.
**Parameters:**
- semanticInventoryListID - The semantic inventory list ID of this store inventory filter value.
- inventoryListID - The real inventory list ID to filter the search result on.
**Throws:**
- NullArgumentException - in case of missing required parameter.
---
## Method Details
### getInventoryListID()
- getInventoryListID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the real inventory list ID of this store inventory filter value.
**Returns:**
- the real inventory list ID of this store inventory filter value.
---
### getSemanticInventoryID()
- getSemanticInventoryID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the semantic inventory ID of this store inventory filter value.
**Returns:**
- the semantic inventory ID of this store inventory filter value.
---
# Class StoreMgr
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.catalog.StoreMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md)
Provides helper methods for getting stores based on id and querying for
stores based on geolocation.
## Property Summary
| Property | Description |
| --- | --- |
| [allStoreGroups](#allstoregroups): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns all the store groups of the current site. |
| [storeIDFromSession](#storeidfromsession): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Get the store id associated with the current session. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [getAllStoreGroups](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#getallstoregroups)() | Returns all the store groups of the current site. |
| static [getStore](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#getstorestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the store object with the specified id or null if store with this id does not exist in the site. |
| static [getStoreGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#getstoregroupstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the store group with the specified id or null if the store group with this id does not exist in the current site. |
| static [getStoreIDFromSession](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#getstoreidfromsession)() | Get the store id associated with the current session. |
| static [searchStoresByCoordinates](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#searchstoresbycoordinatesnumber-number-string-number)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Convenience method. |
| static [searchStoresByCoordinates](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#searchstoresbycoordinatesnumber-number-string-number-string-object)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Search for stores based on geo-coordinates. |
| static [searchStoresByPostalCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#searchstoresbypostalcodestring-string-string-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Convenience method. |
| static [searchStoresByPostalCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#searchstoresbypostalcodestring-string-string-number-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Search for stores by country/postal code and optionally by additional filter criteria. |
| static [setStoreIDToSession](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#setstoreidtosessionstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Set the store id for the current session. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### allStoreGroups
- allStoreGroups: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns all the store groups of the current site.
---
### storeIDFromSession
- storeIDFromSession: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Get the store id associated with the current session. By default, the session store id is null.
---
## Method Details
### getAllStoreGroups()
- static getAllStoreGroups(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all the store groups of the current site.
**Returns:**
- The store groups of the current site.
---
### getStore(String)
- static getStore(storeID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Store](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md)
- : Returns the store object with the specified id or null if store with this
id does not exist in the site.
**Parameters:**
- storeID - the store identifier.
**Returns:**
- Store for specified id or null.
---
### getStoreGroup(String)
- static getStoreGroup(storeGroupID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [StoreGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreGroup.md)
- : Returns the store group with the specified id or null if the store group with this id does not exist in the current site.
**Parameters:**
- storeGroupID - the store group identifier.
**Returns:**
- The store group for specified id or null.
---
### getStoreIDFromSession()
- static getStoreIDFromSession(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the store id associated with the current session. By default, the session store id is null.
**Returns:**
- store id, null is returned and means no store id is set on session
---
### searchStoresByCoordinates(Number, Number, String, Number)
- static searchStoresByCoordinates(latitude: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), longitude: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), distanceUnit: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), maxDistance: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [LinkedHashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.LinkedHashMap.md)
- : Convenience method. Same as searchStoresByCoordinates(latitude, longitude, distanceUnit, maxDistance, null).
**Parameters:**
- latitude - Latitude coordinate which is the center of the search area. Must not be null or an exception is thrown.
- longitude - Longitude coordinate which is the center of the search area. Must not be null or an exception is thrown.
- distanceUnit - The distance unit to be used for the calculation. Supported values are 'mi' and 'km' (for miles and kilometers respectively). If an invalid value is passed then 'km' will be used.
- maxDistance - Area (radius) in DistanceUnit where Stores will be searched for. If null is passed, a system default is used.
**Returns:**
- The stores and their distance from the specified location, sorted
in ascending order by distance.
---
### searchStoresByCoordinates(Number, Number, String, Number, String, Object...)
- static searchStoresByCoordinates(latitude: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), longitude: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), distanceUnit: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), maxDistance: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), queryString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [LinkedHashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.LinkedHashMap.md)
- : Search for stores based on geo-coordinates. The method returns a list of
stores for the current site that are within a specified distance of a
location on the earth and which optionally satisfy additional filter
criteria. If no additional criteria are specified, then this method
behaves similar to GetNearestStores pipelet. The criteria are specified
as a querystring, using the same syntax as
[SystemObjectMgr.querySystemObjects(String, String, String, Object...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SystemObjectMgr.md#querysystemobjectsstring-string-string-object)
The stores and their distance from the specified location are returned as
a LinkedHashMap of Store objects to distances, sorting in ascending order
by distance. The distance is interpreted either in miles or kilometers
depending on the "distanceUnit" parameter.
The latitude and longitude of each store is determined by first looking
at [Store.getLatitude()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getlatitude) and
[Store.getLongitude()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Store.md#getlongitude). If these are not set, then the
system deduces the location of the store by looking for a configured
geolocation matching the store's postal and country codes.
**Parameters:**
- latitude - Latitude coordinate which is the center of the search area. Must not be null or an exception is thrown.
- longitude - Longitude coordinate which is the center of the search area. Must not be null or an exception is thrown.
- distanceUnit - The distance unit to be used for the calculation. Supported values are 'mi' and 'km' (for miles and kilometers respectively). If an invalid value is passed then 'km' will be used.
- maxDistance - Area (radius) in DistanceUnit where Stores will be searched for. If null is passed, a system default is used.
- queryString - optional filter criteria specified as querystring.
- args - the arguments to fill in the values in the querystring.
**Returns:**
- The stores and their distance from the specified location, sorted
in ascending order by distance.
---
### searchStoresByPostalCode(String, String, String, Number)
- static searchStoresByPostalCode(countryCode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), postalCode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), distanceUnit: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), maxDistance: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [LinkedHashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.LinkedHashMap.md)
- : Convenience method. Same as searchStoresByPostalCode(countryCode, postalCode, distanceUnit, maxDistance, null).
**Parameters:**
- countryCode - The country code for the search area, must not be null.
- postalCode - The postal code for the center of the search area, must not be null.
- distanceUnit - The distance unit to be used for the calculation. Supported values are 'mi' and 'km' (for miles and kilometers respectively). If an invalid value is passed then 'km' will be used.
- maxDistance - Area (radius) in DistanceUnit where Stores will be searched for. If null is passed, a system default is used.
**Returns:**
- The stores and their distance from the specified location, sorted
in ascending order by distance.
---
### searchStoresByPostalCode(String, String, String, Number, String, Object...)
- static searchStoresByPostalCode(countryCode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), postalCode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), distanceUnit: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), maxDistance: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), queryString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [LinkedHashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.LinkedHashMap.md)
- : Search for stores by country/postal code and optionally by additional
filter criteria. This method is analagous to
[searchStoresByCoordinates(Number, Number, String, Number, String, Object...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.StoreMgr.md#searchstoresbycoordinatesnumber-number-string-number-string-object)
but identifies a location on the earth indirectly using country and
postal code. The method will look first in the saved geolocations of the
system to find a geolocation matching the passed country and postal code.
If none is found, this method will return an empty map. If one is found,
it will use the latitude/longitude of the found geolocation as the center
of the search.
**Parameters:**
- countryCode - The country code for the search area, must not be null.
- postalCode - The postal code for the center of the search area, must not be null.
- distanceUnit - The distance unit to be used for the calculation. Supported values are 'mi' and 'km' (for miles and kilometers respectively). If an invalid value is passed then 'km' will be used.
- maxDistance - Area (radius) in DistanceUnit where Stores will be searched for. If null is passed, a system default is used.
- queryString - An optional search querystring which provides additional criteria to filter stores by.
- args - The arguments providing the dynamic values to the querystring.
**Returns:**
- The stores and their distance from the specified location, sorted
in ascending order by distance.
---
### setStoreIDToSession(String)
- static setStoreIDToSession(storeID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Set the store id for the current session. The store id is also saved on the cookie with the cookie name
"dw\_store" with no expiration time. Null is allowed to remove store id from session, when null is passed in, the
cookie will be removed when browser exits.
**Parameters:**
- storeID - the id of the store. The leading and trailing white spaces are removed by system from storeID
---
# Class String
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
The String object represents any sequence of zero or more characters that are to be
treated strictly as text.
## Property Summary
| Property | Description |
| --- | --- |
| [length](#length): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The length of the String object. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [String](#string)() | Constructs the String. |
| [String](#stringnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Constructs the String from the specified Number object. |
| [String](#stringstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs a new String from the specified String object. |
## Method Summary
| Method | Description |
| --- | --- |
| [charAt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#charatnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a string containing the character at position _index_. |
| [charCodeAt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#charcodeatnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the UTF-16 code unit at the given position index. |
| [codePointAt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#codepointatnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the Unicode code point at the given position index. |
| [concat](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#concatstring)([String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a new String created by concatenating the string arguments together. |
| [endsWith](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#endswithstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Tests if this string ends with a given string. |
| [endsWith](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#endswithstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Tests if this string ends with a given string. |
| [equals](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#equalsobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns true if this string is equal to the string representation of the passed objects. |
| [equalsIgnoreCase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#equalsignorecaseobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns true if this string is equal to the string representation of the passed objects. |
| static [fromCharCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#fromcharcodenumber)([Number...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a new String from one or more UTF-16 code units. |
| static [fromCodePoint](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#fromcodepointnumber)([Number...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a new String from one or more characters with Unicode code points. |
| [includes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#includesstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns if _substring_ is contained in this String object. |
| [includes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#includesstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns if _substring_ is contained in this String object. |
| [indexOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#indexofstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the index of _substring_ in this String object. |
| [indexOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#indexofstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the index of _substring_ in this String object using the specified _start_ value as the location to begin searching. |
| [lastIndexOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#lastindexofstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the last index of _substring_ in this String object. |
| [lastIndexOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#lastindexofstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the last index of _substring_ in this String object, using the specified _start_ position as the location from which to begin the search. |
| [localeCompare](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#localecomparestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a number indicating whether the current String sorts before, the same as, or after the parameter _other_, based on browser and system-dependent string localization. |
| [match](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#matchregexp)([RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)) | Returns an array of strings that match the regular expression _regexp_. |
| [normalize](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#normalize)() | Returns the normalized form of this Unicode string. |
| [normalize](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#normalizestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the normalized form of this Unicode string according to the standard as described in [https://unicode.org/reports/tr15/](https://unicode.org/reports/tr15/). |
| [padEnd](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#padendnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Appends space characters to the current string to ensure the resulting string reaches the given target length. |
| [padEnd](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#padendnumber-string)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Appends a string (possibly multiple times) to the current string to ensure the resulting string reaches the given target length. |
| [padStart](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#padstartnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Prepends space characters to the current string to ensure the resulting string reaches the given target length. |
| [padStart](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#padstartnumber-string)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Prepends a string (possibly multiple times) to the current string to ensure the resulting string reaches the given target length. |
| static [raw](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#rawobject-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | The static `String.raw()` method is a tag function of template literals. |
| [repeat](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#repeatnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a new string repeating this string the given number of times. |
| [replace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replaceregexp-function)([RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), [Function](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md)) | Returns a new String that results when matches of the _regexp_ parameter are replaced by using the specified _function_. |
| [replace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replaceregexp-string)([RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a new String that results when matches of the _regexp_ parameter are replaced by the _replacement_ parameter. |
| [replace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replacestring-function)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Function](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md)) | Returns a new String that results when matches of the _literal_ parameter are replaced by using the specified _function_. |
| ~~[replace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replacestring-function-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Function](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Returns a new String that results when matches of the _literal_ parameter are replaced by using the specified _function_. |
| [replace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replacestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a new String that results when matches of the _literal_ parameter are replaced by the _replacement_ parameter. |
| ~~[replace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replacestring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Returns a new String that results when matches of the _literal_ parameter are replaced by the _replacement_ parameter. |
| [search](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#searchregexp)([RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)) | Searches for a match between the passed regular expression and this string and returns the zero-based index of the match, or -1 if no match is found. |
| [slice](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#slicenumber-number)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a substring of the current String where the specified _start_ and _end_ locations are used to delimit the String. |
| [split](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#splitregexp)([RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)) | Returns an array of String instances created by splitting the current String based on the regular expression. |
| [split](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#splitregexp-number)([RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns an array of String instances created by splitting the current String based on the regular expression and limited in size by the _limit_ parameter. |
| [split](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#splitstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns an array of String instances created by splitting the current String based on the delimiter. |
| [split](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#splitstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns an array of String instances created by splitting the current String based on the delimiter and limited in size by the _limit_ parameter. |
| [startsWith](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#startswithstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Tests if this string starts with a given string. |
| [startsWith](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#startswithstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Tests if this string starts with a given string. |
| [substr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#substrnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates and returns a new String by splitting the current string at the specified _start_ location until the end of the String. |
| [substr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#substrnumber-number)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates and returns a new String by splitting the current string at the specified _start_ location and limited by the _length_ value. |
| [substring](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#substringnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates and returns a new String by splitting the current string at the specified _from_ location until the end of the String. |
| [substring](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#substringnumber-number)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates and returns a new String by splitting the current string at the specified _from_ location until the specified _to_ location. |
| [toLocaleLowerCase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#tolocalelowercase)() | Returns a copy of the current string in all lower-case letters. |
| [toLocaleUpperCase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#tolocaleuppercase)() | Returns a copy of the current string in all upper-case letters. |
| [toLowerCase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#tolowercase)() | Returns a copy of the current string in all lower-case letters. |
| [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#tostring)() | Returns a String value of this object. |
| [toUpperCase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#touppercase)() | Returns a copy of the current string in all upper-case letters. |
| [trim](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trim)() | Removes white space characters at the start and the end of the string. |
| [trimEnd](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimend)() | Removes white space characters at the end of the string. |
| [trimLeft](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimleft)() | Removes white space characters at the start of the string. |
| [trimRight](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimright)() | Removes white space characters at the end of the string. |
| [trimStart](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimstart)() | Removes white space characters at the start of the string. |
| [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#valueof)() | Returns a String value of this object. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### length
- length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The length of the String object.
---
## Constructor Details
### String()
- String()
- : Constructs the String.
---
### String(Number)
- String(num: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Constructs the String from the specified
Number object.
**Parameters:**
- num - the number that will be converted to a String.
---
### String(String)
- String(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs a new String from the specified
String object.
**Parameters:**
- str - the String that will be converted to a new String.
---
## Method Details
### charAt(Number)
- charAt(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a string containing the character at position _index_.
You should use this method instead
of substring when you need only a single character.
**Parameters:**
- index - the index at which the character string is located.
**Returns:**
- a string containing the character at position _index_.
---
### charCodeAt(Number)
- charCodeAt(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the UTF-16 code unit at the given position index. If the position is invalid `NaN` is returned.
**Parameters:**
- index - The index of the code unit within the string.
**Returns:**
- a non-negative integer representing a UTF-16 code unit or `NaN` if the index is not valid.
---
### codePointAt(Number)
- codePointAt(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the Unicode code point at the given position index. The index is a position within the string in UTF-16
encoding. If the index points to the begin of a surrogate pair the only the code unit at the position is returned.
If the index is invalid `undefined` is returned.
**Parameters:**
- index - The index of the starting code unit within the string.
**Returns:**
- The Unicode code point, an UTF-16 code unit or `undefined`.
**API Version:**
**note:** Available from version 21.2.
---
### concat(String...)
- concat(strings: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a new String created by concatenating the string arguments together.
**Parameters:**
- strings - zero, one, or more String arguments
**Returns:**
- a new String created by concatenating the string arguments together.
---
### endsWith(String)
- endsWith(searchString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Tests if this string ends with a given string.
**Parameters:**
- searchString - The characters to be searched for this string.
**Returns:**
- `true` if the search string was found else `false`
**API Version:**
**note:** Available from version 21.2.
---
### endsWith(String, Number)
- endsWith(searchString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Tests if this string ends with a given string.
**Parameters:**
- searchString - The characters to be searched for this string.
- length - Assumes this string has only this given length.
**Returns:**
- `true` if the search string was found else `false`
**API Version:**
**note:** Available from version 21.2.
---
### equals(Object)
- equals(obj: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns true if this string is equal to the string representation of the
passed objects.
**Parameters:**
- obj - another object, typically another string
---
### equalsIgnoreCase(Object)
- equalsIgnoreCase(obj: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns true if this string is equal to the string representation of the
passed objects. The comparison is done case insensitive.
**Parameters:**
- obj - another object, typically another string
---
### fromCharCode(Number...)
- static fromCharCode(c: [Number...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a new String from one or more UTF-16 code units.
**Parameters:**
- c - zero, one, or more UTF-16 code units.
---
### fromCodePoint(Number...)
- static fromCodePoint(c: [Number...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a new String from one or more characters with Unicode code points.
**Parameters:**
- c - zero, one, or more code points.
**API Version:**
**note:** Available from version 21.2.
---
### includes(String)
- includes(substring: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns if _substring_ is contained in this String object.
**Parameters:**
- substring - the String to search for in this String.
**Returns:**
- `true` if _substring_ occurs within the current string, else `false`.
**API Version:**
**note:** Available from version 21.2.
---
### includes(String, Number)
- includes(substring: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), start: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns if _substring_ is contained in this String object.
**Parameters:**
- substring - the String to search for in this String.
- start - the location in the String from which to begin the search.
**Returns:**
- `true` if _substring_ occurs within the current string, else `false`.
**API Version:**
**note:** Available from version 21.2.
---
### indexOf(String)
- indexOf(substring: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the index of _substring_ in this String object.
If there is no match, _-1_ is returned.
**Parameters:**
- substring - the String to search for in this String.
**Returns:**
- the index of _substring_ or _-1_.
---
### indexOf(String, Number)
- indexOf(substring: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), start: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the index of _substring_ in this String object using
the specified _start_ value as the location to begin searching.
If there is no match, _-1_ is returned.
**Parameters:**
- substring - the String to search for in this String.
- start - the location in the String from which to begin the search.
**Returns:**
- the index of _substring_ or _-1_.
---
### lastIndexOf(String)
- lastIndexOf(substring: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the last index of _substring_ in this String object.
If there is no match, _-1_ is returned.
**Parameters:**
- substring - the String to search for in this String.
**Returns:**
- the last index of _substring_ or _-1_.
---
### lastIndexOf(String, Number)
- lastIndexOf(substring: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), start: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the last index of _substring_ in this String object,
using the specified _start_ position as the location from which
to begin the search.
If there is no match, _-1_ is returned.
**Parameters:**
- substring - the String to search for in this String.
- start - the location from which to begin the search.
**Returns:**
- the last index of _substring_ or _-1_.
---
### localeCompare(String)
- localeCompare(other: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns a number indicating whether the current String sorts before, the same as,
or after the parameter _other_, based on browser and system-dependent
string localization.
**Parameters:**
- other - the String to compare against this String.
**Returns:**
- a number indicating whether the current String sorts before, the same as,
or after the parameter _other_.
---
### match(RegExp)
- match(regexp: [RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)): [String\[\]](TopLevel.String.md)
- : Returns an array of strings that match the regular expression
_regexp_.
**Parameters:**
- regexp - the regular expression to use.
**Returns:**
- an array of strings that match the regular expression.
---
### normalize()
- normalize(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the normalized form of this Unicode string. Same as calling [normalize(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#normalizestring) with parameter **'NFC'**.
**Returns:**
- The normalized form of this Unicode string.
**API Version:**
**note:** Available from version 21.2.
---
### normalize(String)
- normalize(form: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the normalized form of this Unicode string according to the standard as described in [https://unicode.org/reports/tr15/](https://unicode.org/reports/tr15/).
In a normalized string, identical text is replaced by identical sequences of code points.
**Parameters:**
- form - The normalization variant to use. Must be one of **'NFC'**, **'NFD'**, **'NFKC'**, **'NFKD'**.
**Returns:**
- The normalized form of this Unicode string.
**API Version:**
**note:** Available from version 21.2.
---
### padEnd(Number)
- padEnd(targetLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Appends space characters to the current string to ensure the resulting string reaches the given target length.
**Parameters:**
- targetLength - The length to be reached.
**Returns:**
- This string if the string length is already greater than or equal to the target length. Else a new string with the _targetLength_ ending with space characters.
**API Version:**
**note:** Available from version 21.2.
---
### padEnd(Number, String)
- padEnd(targetLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), fillString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Appends a string (possibly multiple times) to the current string to ensure the resulting string reaches the given target length.
**Parameters:**
- targetLength - The length to be reached.
- fillString - The string providing the characters to be used for filling.
**Returns:**
- This string if the string length is already greater than or equal to the target length. Else a new string with the _targetLength_ with the (possibly multiple times) added and truncated _fillString_.
**API Version:**
**note:** Available from version 21.2.
---
### padStart(Number)
- padStart(targetLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Prepends space characters to the current string to ensure the resulting string reaches the given target length.
**Parameters:**
- targetLength - The length to be reached.
**Returns:**
- This string if the string length is already greater than or equal to the target length. Else a new string with the _targetLength_ starting with space characters.
**API Version:**
**note:** Available from version 21.2.
---
### padStart(Number, String)
- padStart(targetLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), fillString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Prepends a string (possibly multiple times) to the current string to ensure the resulting string reaches the given target length.
**Parameters:**
- targetLength - The length to be reached.
- fillString - The string providing the characters to be used for filling.
**Returns:**
- This string if the string length is already greater than or equal to the target length. Else a new string with the _targetLength_ with the (possibly multiple times) added and truncated _fillString_.
**API Version:**
**note:** Available from version 21.2.
---
### raw(Object, String...)
- static raw(callSite: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), substitutions: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The static `String.raw()` method is a tag function of template literals.
It can be used in different ways:
```
String.raw`Hello\n${40+2}!`;
// returns: Hello\n42!
// \ is here not an escape character like in string literals
String.raw({ raw: ['a', 'b', 'c'] }, '-', '.' );
// returns: a-b.c
```
**Parameters:**
- callSite - A well-formed template call site object, like `{ raw: ['a', 'b', 'c'] }`.
- substitutions - The substitution values.
**Returns:**
- A string constructed by the template with filled substitutions.
**API Version:**
**note:** Available from version 22.7.
---
### repeat(Number)
- repeat(count: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a new string repeating this string the given number of times.
**Parameters:**
- count - The number of times this string should be repeated. Must be non-negative.
**Returns:**
- A new string repeating this string the given number of times.
**API Version:**
**note:** Available from version 21.2.
---
### replace(RegExp, Function)
- replace(regexp: [RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), function: [Function](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a new String that results when matches of the _regexp_
parameter are replaced by using the specified _function_. The
original String is not modified so you must capture the new String
in a variable to preserve changes. When you specify a function as the
second parameter, the function is invoked after the match has been performed.
**Parameters:**
- regexp - the regular expression to use.
- function - a Function that operates on matches of _regexp_ in the current String.
**Returns:**
- a new String that results when matches of the _regexp_
parameter are replaced by the _function_.
---
### replace(RegExp, String)
- replace(regexp: [RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), replacement: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a new String that results when matches of the _regexp_
parameter are replaced by the _replacement_ parameter. The
original String is not modified so you must capture the new String
in a variable to preserve changes. If regexp has the global flag set,
all occurrences are replaced, if the global flag is not set only the
first occurrence is replaced.
**Parameters:**
- regexp - the regular expression to use.
- replacement - a String that is to take the place of all matches of _regexp_ in the current String.
**Returns:**
- a new String that results when matches of the _regexp_
parameter are replaced by the _replacement_.
---
### replace(String, Function)
- replace(literal: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), function: [Function](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a new String that results when matches of the _literal_
parameter are replaced by using the specified _function_. The
original String is not modified so you must capture the new String
in a variable to preserve changes. When you specify a function as the
second parameter, the function is invoked after the match has been
performed.
**Parameters:**
- literal - the literal string to locate.
- function - a Function that operates on the match of _literal_ in the current String.
**Returns:**
- a new String that results when the first match of the _literal_
parameter is replaced by the specified _function_.
---
### replace(String, Function, String)
- ~~replace(literal: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), function: [Function](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md), flags: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns a new String that results when matches of the _literal_
parameter are replaced by using the specified _function_. The
original String is not modified so you must capture the new String
in a variable to preserve changes. When you specify a function as the
second parameter, the function is invoked after the match has been
performed.
**Parameters:**
- literal - the literal string to locate.
- function - a Function that operates on the match of _literal_ in the current String.
- flags - a String containing any combination of the Regular Expression flags of g - global match, i - ignore case, m - match over multiple lines.
**Returns:**
- a new String that results when the first match of the _literal_
parameter is replaced by the specified _function_.
**Deprecated:**
**warning:** Use [replace(RegExp, Function)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replaceregexp-function) instead.
**API Version:**
**note:** No longer available as of version 21.2.
---
### replace(String, String)
- replace(literal: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), replacement: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a new String that results when matches of the _literal_
parameter are replaced by the _replacement_ parameter. The
original String is not modified so you must capture the new String
in a variable to preserve changes. This method only replaces the first
occurrence of the literal. To replace all occurrences see the polymorphic
method with a regular expression as argument.
**Parameters:**
- literal - the literal string to locate.
- replacement - a String that is to take the place of all matches of _regexp_ in the current String.
**Returns:**
- a new String that results when the first match of the _literal_
parameter is replaced by the _replacement_ parameter.
---
### replace(String, String, String)
- ~~replace(literal: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), replacement: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), flags: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns a new String that results when matches of the _literal_
parameter are replaced by the _replacement_ parameter. The
original String is not modified so you must capture the new String
in a variable to preserve changes. This method only replaces the first
occurrence of the literal. To replace all occurrences see the polymorphic
method with a regular expression as argument. Note that if flags
**Parameters:**
- literal - the literal string to locate.
- replacement - a String that is to take the place of all matches of _regexp_ in the current String.
- flags - a String containing any combination of the Regular Expression flags of g - global match, i - ignore case, m - match over multiple lines.
**Returns:**
- a new String that results when the first match of the _literal_
parameter is replaced by the _replacement_ parameter.
**Deprecated:**
**warning:** Use [replace(RegExp, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replaceregexp-string) instead.
**API Version:**
**note:** No longer available as of version 21.2.
---
### search(RegExp)
- search(regexp: [RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Searches for a match between the passed regular expression and this
string and returns the zero-based index of the match, or -1 if no match
is found.
**Parameters:**
- regexp - the regular expression to use.
**Returns:**
- the zero-based indexed value of the first character in the
current string that matches the pattern of the regular expression
_regexp_, or -1 if no match is found.
---
### slice(Number, Number)
- slice(start: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), end: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a substring of the current String where the
specified _start_ and _end_ locations are used
to delimit the String.
**Parameters:**
- start - the start position in the current String from which the slice will begin.
- end - the end position in the current String from which the slice will terminate.
**Returns:**
- the String between the _start_ and _end_ positions.
---
### split(RegExp)
- split(regexp: [RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)): [String\[\]](TopLevel.String.md)
- : Returns an array of String instances created by splitting the current
String based on the regular expression.
**Parameters:**
- regexp - the regular expression to use to split the string.
**Returns:**
- an array of String instances created by splitting the current
String based on the regular expression.
---
### split(RegExp, Number)
- split(regexp: [RegExp](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), limit: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String\[\]](TopLevel.String.md)
- : Returns an array of String instances created by splitting the current
String based on the regular expression and limited in size by the _limit_
parameter.
**Parameters:**
- regexp - the regular expression to use to split the string.
- limit - controls the maximum number of items that will be returned.
**Returns:**
- an array of String instances created by splitting the current
String based on the regular expression and limited in size by the _limit_
parameter.
---
### split(String)
- split(delimiter: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String\[\]](TopLevel.String.md)
- : Returns an array of String instances created by splitting the current
String based on the delimiter.
**Parameters:**
- delimiter - the delimiter to use to split the string.
**Returns:**
- an array of String instances created by splitting the current
String based on the delimiter.
---
### split(String, Number)
- split(delimiter: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), limit: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String\[\]](TopLevel.String.md)
- : Returns an array of String instances created by splitting the current
String based on the delimiter and limited in size by the _limit_
parameter.
**Parameters:**
- delimiter - the delimiter to use to split the string.
- limit - controls the maximum number of items that will be returned.
**Returns:**
- an array of String instances created by splitting the current
String based on the delimiter and limited in size by the _limit_
parameter.
---
### startsWith(String)
- startsWith(searchString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Tests if this string starts with a given string.
**Parameters:**
- searchString - The characters to be searched for this string.
**Returns:**
- `true` if the search string was found else `false`
**API Version:**
**note:** Available from version 21.2.
---
### startsWith(String, Number)
- startsWith(searchString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), position: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Tests if this string starts with a given string.
**Parameters:**
- searchString - The characters to be searched for this string.
- position - The position in this string at which to begin searching for searchString.
**Returns:**
- `true` if the search string was found else `false`
**API Version:**
**note:** Available from version 21.2.
---
### substr(Number)
- substr(start: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Creates and returns a new String by splitting the current string
at the specified _start_ location until the end of the String.
**Parameters:**
- start - the start position in the current string from which the new string will be created.
**Returns:**
- a new String created by splitting the current string
starting at the specified _start_ location until the end of the String.
---
### substr(Number, Number)
- substr(start: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Creates and returns a new String by splitting the current string
at the specified _start_ location and limited by the _length_
value.
**Parameters:**
- start - the start position in the current string from which the new string will be created.
- length - controls the length of the new string.
**Returns:**
- a new String created by splitting the current string
starting at the specified _start_ location and limited by the _length_
value.
---
### substring(Number)
- substring(from: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Creates and returns a new String by splitting the current string
at the specified _from_ location until the end of the String.
**Parameters:**
- from - the start position in the current string from which the new string will be created.
**Returns:**
- a new String created by splitting the current string
starting at the specified _from_ location until the end of the String.
---
### substring(Number, Number)
- substring(from: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), to: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Creates and returns a new String by splitting the current string
at the specified _from_ location until the specified _to_ location.
**Parameters:**
- from - the start position in the current string from which the new string will be created.
- to - the end position in the current string from which the new string will be created.
**Returns:**
- a new String created by splitting the current string
starting at the specified _from_ location until the specified
_to_ location.
value.
---
### toLocaleLowerCase()
- toLocaleLowerCase(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a copy of the current string in all lower-case letters.
**Returns:**
- a copy of the current string in all lower-case letters.
---
### toLocaleUpperCase()
- toLocaleUpperCase(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a copy of the current string in all upper-case letters.
**Returns:**
- a copy of the current string in all upper-case letters.
---
### toLowerCase()
- toLowerCase(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a copy of the current string in all lower-case letters.
**Returns:**
- a copy of the current string in all lower-case letters.
---
### toString()
- toString(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a String value of this object.
**Returns:**
- a String value of this object.
---
### toUpperCase()
- toUpperCase(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a copy of the current string in all upper-case letters.
**Returns:**
- a copy of the current string in all upper-case letters.
---
### trim()
- trim(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Removes white space characters at the start and the end of the string.
**Returns:**
- A new string without leading and ending white space characters.
---
### trimEnd()
- trimEnd(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Removes white space characters at the end of the string.
**Returns:**
- A new string without ending white space characters.
**API Version:**
**note:** Available from version 21.2.
---
### trimLeft()
- trimLeft(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Removes white space characters at the start of the string.
[trimStart()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimstart) should be used instead of this.
**Returns:**
- A new string without leading white space characters.
**API Version:**
**note:** Available from version 21.2.
---
### trimRight()
- trimRight(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Removes white space characters at the end of the string.
[trimEnd()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimend) should be used instead of this.
**Returns:**
- A new string without ending white space characters.
**API Version:**
**note:** Available from version 21.2.
---
### trimStart()
- trimStart(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Removes white space characters at the start of the string.
**Returns:**
- A new string without leading white space characters.
**API Version:**
**note:** Available from version 21.2.
---
### valueOf()
- valueOf(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a String value of this object.
**Returns:**
- a String value of this object.
---
# Class StringUtils
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.util.StringUtils](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md)
String utility class.
## Constant Summary
| Constant | Description |
| --- | --- |
| [ENCODE_TYPE_HTML](#encode_type_html): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0 | String encoding type HTML. |
| ~~[ENCODE_TYPE_WML](#encode_type_wml): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2~~ | String encoding type WML. |
| [ENCODE_TYPE_XML](#encode_type_xml): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | String encoding type XML. |
| [TRUNCATE_CHAR](#truncate_char): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "char" | String truncate mode 'char'. |
| [TRUNCATE_SENTENCE](#truncate_sentence): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "sentence" | String truncate mode 'sentence'. |
| [TRUNCATE_WORD](#truncate_word): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "word" | String truncate mode 'word'. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [decodeBase64](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#decodebase64string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Interprets a Base64 encoded string as byte stream of an UTF-8 encoded string. |
| static [decodeBase64](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#decodebase64string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Interprets a Base64 encoded string as the byte stream representation of a string. |
| static [decodeString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#decodestringstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Convert a given syntax-safe string to a string according to the selected character entity encoding type. |
| static [encodeBase64](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#encodebase64string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Encodes the byte representation of the given string as Base64. |
| static [encodeBase64](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#encodebase64string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Encodes the byte representation of the given string as Base64. |
| static [encodeString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#encodestringstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Convert a given string to a syntax-safe string according to the selected character entity encoding type. |
| static [format](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatstring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns a formatted string using the specified format and arguments. |
| static [formatCalendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatcalendarcalendar)([Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md)) | Formats a Calendar object with Calendar.INPUT\_DATE\_TIME\_PATTERN format of the current request locale, for example "MM/dd/yyyy h:mm a" for the locale en\_US. |
| static [formatCalendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatcalendarcalendar-string)([Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Formats a Calendar object with the provided date format. |
| static [formatCalendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatcalendarcalendar-string-number)([Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Formats a Calendar object with the date format defined by the provided locale and Calendar pattern. |
| ~~static [formatDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatdatedate)([Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md))~~ | Formats a date with the default date format of the current site. |
| ~~static [formatDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatdatedate-string)([Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Formats a date with the provided date format. |
| ~~static [formatDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatdatedate-string-string)([Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Formats a date with the provided date format in specified locale. |
| static [formatInteger](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatintegernumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a formatted integer number using the default integer format of the current site. |
| static [formatMoney](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatmoneymoney)([Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md)) | Formats a Money Object with the default money format of the current request locale. |
| static [formatNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatnumbernumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a formatted number using the default number format of the current site. |
| static [formatNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatnumbernumber-string---variant-1)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a formatted string using the specified number and format. |
| static [formatNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatnumbernumber-string-string---variant-1)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a formatted number as a string using the specified number format in specified locale. |
| static [formatNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatnumbernumber-string---variant-2)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a formatted string using the specified number and format. |
| static [formatNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatnumbernumber-string-string---variant-2)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a formatted number as a string using the specified number format in specified locale. |
| static [garble](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#garblestring-string-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Return a string in which specified number of characters in the suffix is not changed and the rest of the characters replaced with specified character. |
| static [ltrim](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#ltrimstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the string with leading white space removed. |
| static [pad](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#padstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | This method provides cell padding functionality to the template. |
| static [rtrim](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#rtrimstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the string with trailing white space removed. |
| static [stringToHtml](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#stringtohtmlstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Convert a given string to an HTML-safe string. |
| ~~static [stringToWml](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#stringtowmlstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Converts a given string to a WML-safe string. |
| static [stringToXml](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#stringtoxmlstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Converts a given string to a XML-safe string. |
| static [trim](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#trimstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the string with leading and trailing white space removed. |
| static [truncate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#truncatestring-number-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Truncate the string to the specified length using specified truncate mode. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### ENCODE_TYPE_HTML
- ENCODE_TYPE_HTML: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0
- : String encoding type HTML.
**See Also:**
- [encodeString(String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#encodestringstring-number)
---
### ENCODE_TYPE_WML
- ~~ENCODE_TYPE_WML: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2~~
- : String encoding type WML.
**See Also:**
- [encodeString(String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#encodestringstring-number)
**Deprecated:**
**warning:** Don't use this constant anymore.
---
### ENCODE_TYPE_XML
- ENCODE_TYPE_XML: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : String encoding type XML.
**See Also:**
- [encodeString(String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#encodestringstring-number)
---
### TRUNCATE_CHAR
- TRUNCATE_CHAR: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "char"
- : String truncate mode 'char'. Truncate string to the nearest character. Default mode if no truncate mode is specified.
**See Also:**
- [truncate(String, Number, String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#truncatestring-number-string-string)
---
### TRUNCATE_SENTENCE
- TRUNCATE_SENTENCE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "sentence"
- : String truncate mode 'sentence'. Truncate string to the nearest sentence.
**See Also:**
- [truncate(String, Number, String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#truncatestring-number-string-string)
---
### TRUNCATE_WORD
- TRUNCATE_WORD: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "word"
- : String truncate mode 'word'. Truncate string to the nearest word.
**See Also:**
- [truncate(String, Number, String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#truncatestring-number-string-string)
---
## Method Details
### decodeBase64(String)
- static decodeBase64(base64: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Interprets a Base64 encoded string as byte stream of an UTF-8 encoded string.
The method throws an IllegalArgumentException in case the encoding
failed because of a mismatch between the input string and the character encoding.
**Parameters:**
- base64 - the Base64 encoded string - should not be empty or `null`.
**Returns:**
- the decoded string.
---
### decodeBase64(String, String)
- static decodeBase64(base64: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), characterEncoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Interprets a Base64 encoded string as the byte stream representation of a string.
The given character encoding is used for decoding the byte stream into the
character representation.
The method throws an IllegalArgumentException in case the encoding
failed because of a mismatch between the input String and the character encoding.
**Parameters:**
- base64 - the Base64 encoded string - should not be empty or `null`.
- characterEncoding - the character encoding to read the input string - should not be empty or `null`.
**Returns:**
- the decoded string.
---
### decodeString(String, Number)
- static decodeString(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Convert a given syntax-safe string to a string according to the
selected character entity encoding type.
**Parameters:**
- str - String to be decoded
- type - decode type
**Returns:**
- decoded string
---
### encodeBase64(String)
- static encodeBase64(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Encodes the byte representation of the given string as Base64.
The string is converted into the byte representation with UTF-8 encoding.
The method throws an IllegalArgumentException in case the encoding
failed because of a mismatch between the input string and the character encoding.
**Parameters:**
- str - the string to encode - should not be empty or `null`.
**Returns:**
- the encoded string.
---
### encodeBase64(String, String)
- static encodeBase64(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), characterEncoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Encodes the byte representation of the given string as Base64.
The string is converted into the byte representation using the given
character encoding.
The method throws an IllegalArgumentException in case the encoding
failed because of a mismatch between the input string and the character encoding.
**Parameters:**
- str - the string to encode - should not be empty or `null`.
- characterEncoding - the character encoding to read the input string - should not be empty or `null`.
**Returns:**
- the encoded string.
---
### encodeString(String, Number)
- static encodeString(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Convert a given string to a syntax-safe string according to the
selected character entity encoding type.
**Parameters:**
- str - String to be encoded
- type - encode type
**Returns:**
- encoded string
---
### format(String, Object...)
- static format(format: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a formatted string using the specified format and arguments.
The formatting string is a Java MessageFormat expression, e.g.
format( "Message: {0}, {1}", "test", 10 ) would result in "Message: test, 10".
If a Collection is passed as the only argument, the elements of this collection
are used as arguments for the formatting.
**Parameters:**
- format - Java like formatting string.
- args - optional list of arguments or a collection, which are included into the result string
**Returns:**
- the formatted result string.
---
### formatCalendar(Calendar)
- static formatCalendar(calendar: [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Formats a Calendar object with Calendar.INPUT\_DATE\_TIME\_PATTERN format
of the current request locale, for example "MM/dd/yyyy h:mm a" for the
locale en\_US. The used time zone is the time zone of the calendar object.
**Parameters:**
- calendar - the calendar object.
**Returns:**
- a string representation of the formatted calendar object.
---
### formatCalendar(Calendar, String)
- static formatCalendar(calendar: [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md), format: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Formats a Calendar object with the provided date format. The format is a
Java date format, like "yyy-MM-dd". The used time zone is the time zone
of the calendar object.
**Parameters:**
- calendar - the calendar object to be printed
- format - the format to use.
**Returns:**
- a string representation of the formatted calendar object.
---
### formatCalendar(Calendar, String, Number)
- static formatCalendar(calendar: [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md), locale: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), pattern: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Formats a Calendar object with the date format defined by the provided locale
and Calendar pattern. The locale can be for instance the request.getLocale().
The used time zone is the time zone of the calendar object.
**Parameters:**
- calendar - the calendar object to be printed
- locale - the locale, which defines the date format to be used
- pattern - the pattern is one of a calendar pattern e.g. SHORT\_DATE\_PATTERN as defined in the regional settings for the locale
**Returns:**
- a string representation of the formatted calendar object.
---
### formatDate(Date)
- ~~static formatDate(date: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Formats a date with the default date format of the current site.
**Parameters:**
- date - the date to format.
**Returns:**
- a string representation of the formatted date.
**Deprecated:**
**warning:** Use [formatCalendar(Calendar, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatcalendarcalendar-string) instead.
---
### formatDate(Date, String)
- ~~static formatDate(date: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md), format: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Formats a date with the provided date format. The format is the
Java date format, like "yyyy-MM-DD". The locale of the calling context
request is used in formatting.
**Parameters:**
- date - the date to format.
- format - the format to use.
**Returns:**
- a string representation of the formatted date.
**Deprecated:**
**warning:** Use [formatCalendar(Calendar, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatcalendarcalendar-string) instead.
---
### formatDate(Date, String, String)
- ~~static formatDate(date: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md), format: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), locale: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Formats a date with the provided date format in specified locale. The format is
Java date format, like "yyyy-MM-DD".
**Parameters:**
- date - the date to format.
- format - the format to use.
- locale - the locale to use.
**Returns:**
- a string representation of the formatted date.
**Deprecated:**
**warning:** Use [formatCalendar(Calendar, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.StringUtils.md#formatcalendarcalendar-string) instead.
---
### formatInteger(Number)
- static formatInteger(number: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a formatted integer number using the default integer format of the current
site. The method can be also called to format a floating number as integer.
**Parameters:**
- number - the number to format.
**Returns:**
- a formatted an integer number with the default integer format of the current
site.
---
### formatMoney(Money)
- static formatMoney(money: [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Formats a Money Object with the default money format of the current request locale.
**Parameters:**
- money - The Money instance that should be formatted.
**Returns:**
- The formatted String representation of the passed
money. In case of an error the string 'N/A' is returned.
---
### formatNumber(Number)
- static formatNumber(number: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a formatted number using the default number format of the current site.
Decimal and grouping separators are used as specified in the locales regional settings.
**Parameters:**
- number - the number to format.
**Returns:**
- a formatted number using the default number format of the current site.
---
### formatNumber(Number, String) - Variant 1
- static formatNumber(number: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), format: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a formatted string using the specified number and format. The format is
Java number format, like "\#,\#\#\#.00". To format as an integer
number provide "0" as format string. The locale of the calling context
request is used in formatting.
**Parameters:**
- number - the number to format.
- format - the format to use.
**Returns:**
- a formatted string using the specified number and format.
**API Version:**
**note:** No longer available as of version 18.10.
---
### formatNumber(Number, String, String) - Variant 1
- static formatNumber(number: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), format: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), locale: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a formatted number as a string using the specified number format in specified locale. The format is
Java number format, like "\#,\#\#\#.00". To format as an integer
number provide "0" as format string.
**Parameters:**
- number - the number to format.
- format - the format to use.
- locale - the locale to use.
**Returns:**
- a formatted number as a string using the specified number format in specified locale.
**API Version:**
**note:** No longer available as of version 18.10.
---
### formatNumber(Number, String) - Variant 2
- static formatNumber(number: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), format: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a formatted string using the specified number and format. The format is
Java number format, like "\#,\#\#\#.00". To format as an integer
number provide "0" as format string. The locale of the calling context
request is used in formatting.
Decimal and grouping separators are used as specified in the locales regional settings (when configured, otherwise a fallback to the internal configuration is done).
**Parameters:**
- number - the number to format.
- format - the format to use.
**Returns:**
- a formatted string using the specified number and format.
**API Version:**
**note:** Available from version 18.10.
In prior versions this method did fall back to Java formatting rules, instead of using the definitions in regional settings.
---
### formatNumber(Number, String, String) - Variant 2
- static formatNumber(number: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), format: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), locale: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a formatted number as a string using the specified number format in specified locale. The format is
Java number format, like "\#,\#\#\#.00". To format as an integer
number provide "0" as format string.
Decimal and grouping separators are used as specified in the locales regional settings (when configured, otherwise a fallback to the internal configuration is done).
**Parameters:**
- number - the number to format.
- format - the format to use.
- locale - the locale to use.
**Returns:**
- a formatted number as a string using the specified number format in specified locale.
**API Version:**
**note:** Available from version 18.10.
In prior versions this method did fall back to Java formatting rules, instead of using the definitions in regional settings.
---
### garble(String, String, Number)
- static garble(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), replaceChar: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), suffixLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Return a string in which specified number of characters in the suffix is not changed
and the rest of the characters replaced with specified character.
**Parameters:**
- str - String to garble
- replaceChar - character to use as a replacement
- suffixLength - length of the suffix
**Returns:**
- the garbled string.
---
### ltrim(String)
- static ltrim(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the string with leading white space removed.
**Parameters:**
- str - the String to remove characters from.
**Returns:**
- the string with leading white space removed.
---
### pad(String, Number)
- static pad(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), width: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : This method provides cell padding functionality to the template.
**Parameters:**
- str - the string to process
- width - The absolute value of this number defines the width of the cell. A possitive number forces left, a negative number right alignment. A '0' doesn't change the string.
**Returns:**
- the processed string.
---
### rtrim(String)
- static rtrim(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the string with trailing white space removed.
**Parameters:**
- str - the String to remove characters from.
**Returns:**
- the string with trailing white space removed.
---
### stringToHtml(String)
- static stringToHtml(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Convert a given string to an HTML-safe string.
This method substitutes characters that conflict with HTML syntax
(<,>,&,") and characters that are beyond the ASCII
chart (Unicode 160-255) to HTML 3.2 named character entities.
**Parameters:**
- str - String to be converted.
**Returns:**
- converted string.
---
### stringToWml(String)
- ~~static stringToWml(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Converts a given string to a WML-safe string.
This method substitutes characters that conflict with WML syntax
(<,>,&,',"$) to WML named character entities.
**Parameters:**
- str - String to be converted.
**Returns:**
- the converted string.
**Deprecated:**
**warning:** Don't use this method anymore
---
### stringToXml(String)
- static stringToXml(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Converts a given string to a XML-safe string.
This method substitutes characters that conflict with XML syntax
(<,>,&,',") to XML named character entities.
**Parameters:**
- str - String to be converted.
**Returns:**
- the converted string.
---
### trim(String)
- static trim(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the string with leading and trailing white space removed.
**Parameters:**
- str - the string to trim.
**Returns:**
- the string with leading and trailing white space removed.
---
### truncate(String, Number, String, String)
- static truncate(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), maxLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), mode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), suffix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Truncate the string to the specified length using specified truncate mode. Optionally,
append suffix to truncated string.
**Parameters:**
- str - string to truncate
- maxLength - maximum length of the truncated string, not including suffix
- mode - truncate mode (TRUNCATE\_CHAR, TRUNCATE\_WORD, TRUNCATE\_SENTENCE), if null TRUNCATE\_CHAR is assumed
- suffix - suffix append to the truncated string
**Returns:**
- the truncated string.
---
# Class StringWriter
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.io.Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)
- [dw.io.StringWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.StringWriter.md)
A Writer that can be used to generate a String.
In most cases it is not necessary to use StringWriter. If the final
destination of the output is a file, use [FileWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.FileWriter.md) directly.
This will help to reduce memory usage. If you wish to transfer a feed to a
remote FTP, SFTP or WebDAV server, first write the feed to the file system
using FileWriter and optionally [CSVStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.CSVStreamWriter.md) or
[XMLStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md), then upload the file with
[FTPClient.putBinary(String, File)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.FTPClient.md#putbinarystring-file),
[SFTPClient.putBinary(String, File)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.SFTPClient.md#putbinarystring-file), or
[WebDAVClient.put(String, File)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#putstring-file).
**Note:** when this class is used with sensitive data, be careful in persisting sensitive information to disk.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [StringWriter](#stringwriter)() | Creates a new StringWriter. |
## Method Summary
| Method | Description |
| --- | --- |
| [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.StringWriter.md#tostring)() | Returns a string representation of this writer. |
| [write](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.StringWriter.md#writestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Write the given string to the stream. |
| [write](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.StringWriter.md#writestring-number-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Write the given string to the stream. |
### Methods inherited from class Writer
[close](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md#close), [flush](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md#flush), [write](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md#writestring), [write](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md#writestring-number-number)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### StringWriter()
- StringWriter()
- : Creates a new StringWriter.
---
## Method Details
### toString()
- toString(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a string representation of this writer.
**Returns:**
- a string representation of this writer.
---
### write(String)
- write(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Write the given string to the stream.
**Parameters:**
- str - the string to write to the stream.
---
### write(String, Number, Number)
- write(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), off: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), len: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void
- : Write the given string to the stream.
**Parameters:**
- str - the string to write to the stream.
- off - the offset from which to start writing characters to the stream.
- len - the number of characters to write from the stream.
---
# Class Stub
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.rpc.Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md)
This is the base class for all service stubs accessible
through a WebReference object. The Stub provides access to the WSDL operations.
Demandware recommends a low timeout to ensure responsiveness
of the site and to avoid thread exhaustion. Use the Services module
in Business Manager to set timeout values, not the methods for this class.
The Services module provides better analytics and timeout management.
The default timeout, if not set, is 15 minutes when the web service is used in a job,
and 2 minutes otherwise. If the timeout of the calling script is lower,
the script timeout is used.
```
// get WebReference
var webref : WebReference = webreferences.myWSDLname;
// get service stub
var stub : Stub = webref.defaultService;
```
**See Also:**
- [WebReference](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.WebReference.md)
- [SOAPUtil](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md)
**Deprecated:**
**warning:** This class is deprecated, please use webreferences2 instead (see also [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)).
## Constant Summary
| Constant | Description |
| --- | --- |
| ~~[CONNECTION_TIMEOUT](#connection_timeout): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ | This property allows the user to set the web service connection timeout value in milliseconds. |
| ~~[ENDPOINT_ADDRESS_PROPERTY](#endpoint_address_property): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ | Standard property: target service endpoint address. |
| ~~[PASSWORD_PROPERTY](#password_property): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ | Standard property: password for authentication. |
| ~~[SESSION_MAINTAIN_PROPERTY](#session_maintain_property): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ | Standard property: this boolean property is used by a service client to indicate whether or not it wants to participate in a session with a service endpoint. |
| ~~[USERNAME_PROPERTY](#username_property): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ | Standard property: user name for authentication. |
## Property Summary
| Property | Description |
| --- | --- |
| ~~[password](#password): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ | Returns the password. |
| ~~[timeout](#timeout): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)~~ | Returns the current read timeout value in milliseconds for this Stub. |
| ~~[username](#username): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ | Returns the user name. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Stub](#stub)() | |
## Method Summary
| Method | Description |
| --- | --- |
| ~~[_getProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#_getpropertystring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Gets the value of a specific configuration property. |
| ~~[_setProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#_setpropertystring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))~~ | Sets the name and value of a configuration property for this Stub instance. |
| ~~[getPassword](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#getpassword)()~~ | Returns the password. |
| ~~[getTimeout](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#gettimeout)()~~ | Returns the current read timeout value in milliseconds for this Stub. |
| ~~[getUsername](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#getusername)()~~ | Returns the user name. |
| ~~[setHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#setheaderstring-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))~~ | Sets an additional SOAP header value for the next operation. |
| ~~[setPassword](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#setpasswordstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Sets the password. |
| ~~[setTimeout](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#settimeoutnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))~~ | Sets the timeout in milliseconds for the next call through this Stub. |
| ~~[setUsername](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#setusernamestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Sets the user name. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### CONNECTION_TIMEOUT
- ~~CONNECTION_TIMEOUT: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : This property allows the user to set the web service connection timeout value in milliseconds. By default,
the web service connection timeout is 5000 milliseconds (5 seconds). The minimum allowed value is 100 milliseconds
and the maximum allowed value is 15000 milliseconds (15 seconds). Demandware recommends setting timeout values
in Business Manager Services module as it provides better analytics and timeout management.
**Deprecated:**
**warning:** use webreferences2 instead
---
### ENDPOINT_ADDRESS_PROPERTY
- ~~ENDPOINT_ADDRESS_PROPERTY: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Standard property: target service endpoint address. The
URI scheme for the endpoint address specification must
correspond to the protocol/transport binding for this
stub class.
**Deprecated:**
**warning:** use webreferences2 instead
---
### PASSWORD_PROPERTY
- ~~PASSWORD_PROPERTY: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Standard property: password for authentication.
**Deprecated:**
**warning:** use webreferences2 instead
---
### SESSION_MAINTAIN_PROPERTY
- ~~SESSION_MAINTAIN_PROPERTY: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Standard property: this boolean property is used by a service
client to indicate whether or not it wants to participate in
a session with a service endpoint. If this property is set to
true, the service client indicates that it wants the session
to be maintained. If set to false, the session is not maintained.
The default value for this property is false.
**Deprecated:**
**warning:** use webreferences2 instead
---
### USERNAME_PROPERTY
- ~~USERNAME_PROPERTY: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Standard property: user name for authentication.
**Deprecated:**
**warning:** use webreferences2 instead
---
## Property Details
### password
- ~~password: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns the password.
**Deprecated:**
**warning:** use webreferences2 instead
---
### timeout
- ~~timeout: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)~~
- : Returns the current read timeout value in milliseconds for this Stub.
**Deprecated:**
**warning:** use webreferences2 instead
---
### username
- ~~username: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns the user name.
**Note:** this method handles sensitive security-related data.
Pay special attention to PCI DSS v3. requirements 2, 4, and 12.
**Deprecated:**
**warning:** use webreferences2 instead
---
## Constructor Details
### Stub()
- Stub()
- :
---
## Method Details
### _getProperty(String)
- ~~_getProperty(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)~~
- : Gets the value of a specific configuration property.
**Parameters:**
- name - Name of the property whose value is to be retrieved
**Returns:**
- Value of the configuration property
**Deprecated:**
**warning:** use webreferences2 instead
---
### _setProperty(String, Object)
- ~~_setProperty(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void~~
- : Sets the name and value of a configuration property
for this Stub instance. If the Stub instance contains
a value for the same property, the old value is replaced.
**Note:** the `_setProperty` method may not
perform a validity check on a configured property value. An
example is the standard property for the target service
endpoint address, which is not checked for validity in the
`_setProperty` method.
In this case, stub configuration errors are detected at
the remote method invocation.
**Parameters:**
- name - Name of the configuration property
- value - Value of the property
**Deprecated:**
**warning:** use webreferences2 instead
---
### getPassword()
- ~~getPassword(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns the password.
**Returns:**
- the password.
**Note:** this method handles sensitive security-related data.
Pay special attention to PCI DSS v3. requirements 2, 4, and 12.
**Deprecated:**
**warning:** use webreferences2 instead
---
### getTimeout()
- ~~getTimeout(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)~~
- : Returns the current read timeout value in milliseconds for this Stub.
**Returns:**
- the current timeout value for this Stub.
**Deprecated:**
**warning:** use webreferences2 instead
---
### getUsername()
- ~~getUsername(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Returns the user name.
**Note:** this method handles sensitive security-related data.
Pay special attention to PCI DSS v3. requirements 2, 4, and 12.
**Returns:**
- the user name.
**Deprecated:**
**warning:** use webreferences2 instead
---
### setHeader(String, String, Object)
- ~~setHeader(namespace: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void~~
- : Sets an additional SOAP header value for the next
operation.
**Parameters:**
- namespace - the namespace to use.
- name - the name of the header item.
- value - the value for the header item.
**Deprecated:**
**warning:** use webreferences2 instead
---
### setPassword(String)
- ~~setPassword(password: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void~~
- : Sets the password.
**Parameters:**
- password - the password to set.
**Deprecated:**
**warning:** use webreferences2 instead
---
### setTimeout(Number)
- ~~setTimeout(timeout: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void~~
- : Sets the timeout in milliseconds for the next call through this Stub.
This timeout value controls "read timeout" (how
long, after connecting, it will wait without any data being read).
To control "connection timeout" you use the [_setProperty(String, Object)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#_setpropertystring-object)
method where the name parameter is [CONNECTION_TIMEOUT](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#connection_timeout).
**Parameters:**
- timeout - the timeout for the next call through this stub.
**See Also:**
- [_setProperty(String, Object)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#_setpropertystring-object)
- [CONNECTION_TIMEOUT](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md#connection_timeout)
**Deprecated:**
**warning:** use webreferences2 instead
---
### setUsername(String)
- ~~setUsername(username: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void~~
- : Sets the user name.
**Parameters:**
- username - the user name to set.
**Deprecated:**
**warning:** use webreferences2 instead
---
# Class SuggestedCategory
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.suggest.SuggestedCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedCategory.md)
This class represents a suggested catalog category.
Use [getCategory()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedCategory.md#getcategory) method to get access to the actual [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) object.
## Property Summary
| Property | Description |
| --- | --- |
| [category](#category): [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) `(read-only)` | This method returns the actual [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) object corresponding to this suggested category. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedCategory.md#getcategory)() | This method returns the actual [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) object corresponding to this suggested category. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### category
- category: [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) `(read-only)`
- : This method returns the actual [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) object corresponding to this suggested category.
---
## Method Details
### getCategory()
- getCategory(): [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md)
- : This method returns the actual [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) object corresponding to this suggested category.
**Returns:**
- the category object corresponding to this suggested category
---
# Class SuggestedContent
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.suggest.SuggestedContent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedContent.md)
This class represents a suggested content page.
Use [getContent()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedContent.md#getcontent) method to get access to the actual [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md) object.
## Property Summary
| Property | Description |
| --- | --- |
| [content](#content): [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md) `(read-only)` | This method returns the actual [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md) object corresponding to this suggested content. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getContent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedContent.md#getcontent)() | This method returns the actual [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md) object corresponding to this suggested content. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### content
- content: [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md) `(read-only)`
- : This method returns the actual [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md) object corresponding to this suggested content.
---
## Method Details
### getContent()
- getContent(): [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md)
- : This method returns the actual [Content](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md) object corresponding to this suggested content.
**Returns:**
- the content object corresponding to this suggested content
---
# Class SuggestedPhrase
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.suggest.SuggestedPhrase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md)
This class represents a suggested phrase.
Use [getPhrase()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md#getphrase) method to get access to the phrase.
## Property Summary
| Property | Description |
| --- | --- |
| [exactMatch](#exactmatch): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | This method returns a flag signaling whether this phrase is a exact match. |
| [phrase](#phrase): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | This method returns the actual phrase as a string value. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getPhrase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md#getphrase)() | This method returns the actual phrase as a string value. |
| [isExactMatch](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md#isexactmatch)() | This method returns a flag signaling whether this phrase is a exact match. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### exactMatch
- exactMatch: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : This method returns a flag signaling whether this phrase is a exact match.
---
### phrase
- phrase: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : This method returns the actual phrase as a string value.
---
## Method Details
### getPhrase()
- getPhrase(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : This method returns the actual phrase as a string value.
**Returns:**
- the phrase
---
### isExactMatch()
- isExactMatch(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : This method returns a flag signaling whether this phrase is a exact match.
**Returns:**
- true if this phrase is a exact match, false otherwise
---
# Class SuggestedProduct
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.suggest.SuggestedProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedProduct.md)
This class represents a suggested product.
Use [getProductSearchHit()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedProduct.md#getproductsearchhit) method to get access to the actual [ProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchHit.md) object.
## Property Summary
| Property | Description |
| --- | --- |
| [productSearchHit](#productsearchhit): [ProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchHit.md) `(read-only)` | This method returns the actual [ProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchHit.md) object corresponding to this suggested product. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedProduct.md#getproductsearchhit)() | This method returns the actual [ProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchHit.md) object corresponding to this suggested product. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### productSearchHit
- productSearchHit: [ProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchHit.md) `(read-only)`
- : This method returns the actual [ProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchHit.md) object
corresponding to this suggested product.
---
## Method Details
### getProductSearchHit()
- getProductSearchHit(): [ProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchHit.md)
- : This method returns the actual [ProductSearchHit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchHit.md) object
corresponding to this suggested product.
**Returns:**
- the product search hit corresponding to this suggested product
---
# Class SuggestedTerm
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.suggest.SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md)
A single suggested term.
Each user input term of the search phrase
is being processed separately by the suggestion engine. For each
original term, a list of terms will be suggested, either completed terms,
corrected terms or even the exact term if it is known to the engine.
Each suggested term is represented by a instance of this class. The list of suggested terms
belonging to a single original term is represented by a instance of [SuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) class.
The suggested term value can either be the completed version of the original term,
the corrected version of the original term or exactly the original term.
## Property Summary
| Property | Description |
| --- | --- |
| [additional](#additional): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns whether this suggested term is a additional term that has no corresponding term in the original search phrase. |
| [completed](#completed): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns whether this suggested term is a auto completed version of the original term. |
| [corrected](#corrected): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns whether this suggested term is a corrected version of the original term. |
| [exactMatch](#exactmatch): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns whether this suggested term is exactly matching the original term. |
| [value](#value): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns this suggested term as String value. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md#getvalue)() | Returns this suggested term as String value. |
| [isAdditional](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md#isadditional)() | Returns whether this suggested term is a additional term that has no corresponding term in the original search phrase. |
| [isCompleted](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md#iscompleted)() | Returns whether this suggested term is a auto completed version of the original term. |
| [isCorrected](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md#iscorrected)() | Returns whether this suggested term is a corrected version of the original term. |
| [isExactMatch](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md#isexactmatch)() | Returns whether this suggested term is exactly matching the original term. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### additional
- additional: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns whether this suggested term is a additional term that has no corresponding term in the original search phrase.
---
### completed
- completed: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns whether this suggested term is a auto completed version of the original term.
In other words, this method returns true if the original term is a prefix of this suggested term.
---
### corrected
- corrected: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns whether this suggested term is a corrected version of the original term.
---
### exactMatch
- exactMatch: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns whether this suggested term is exactly matching the original term.
---
### value
- value: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns this suggested term as String value.
---
## Method Details
### getValue()
- getValue(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns this suggested term as String value.
**Returns:**
- the string representation of this suggested term
---
### isAdditional()
- isAdditional(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns whether this suggested term is a additional term that has no corresponding term in the original search phrase.
**Returns:**
- `true` if this suggested term is a additional term, `false` otherwise
---
### isCompleted()
- isCompleted(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns whether this suggested term is a auto completed version of the original term.
In other words, this method returns true if the original term is a prefix of this suggested term.
**Returns:**
- `true` if this suggested term is evaluated by auto completion, `false` otherwise
---
### isCorrected()
- isCorrected(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns whether this suggested term is a corrected version of the original term.
**Returns:**
- `true` if this suggested term is a corrected version of the original term, `false` otherwise
---
### isExactMatch()
- isExactMatch(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns whether this suggested term is exactly matching the original term.
**Returns:**
- `true` if this suggested term exactly matches the original term, `false` otherwise
---
# Class SuggestedTerms
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.suggest.SuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md)
This container represents a list of suggested terms, all belonging to a
particular single original term of the users input search phrase.
Each user input term of the search phrase
is being processed separately by the suggestion engine. For each
original term, a list of terms will be suggested, either completed terms,
corrected terms or even the exact term if they are known to the engine as they are.
A instance of this class refers to the original unmodified term, as well as
to a list of [SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md)s objects representing a single suggested term.
## Property Summary
| Property | Description |
| --- | --- |
| [empty](#empty): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns true if this set of suggested terms is empty. |
| [firstTerm](#firstterm): [SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md) `(read-only)` | This method returns the suggested term which is considered best matching with the original term. |
| [originalTerm](#originalterm): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the original term of the user input, for which this instance provides a list of suggested terms. |
| [terms](#terms): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md) `(read-only)` | Returns the list of [SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md)s suggested for the original term. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getFirstTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getfirstterm)() | This method returns the suggested term which is considered best matching with the original term. |
| [getOriginalTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getoriginalterm)() | Returns the original term of the user input, for which this instance provides a list of suggested terms. |
| [getTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getterms)() | Returns the list of [SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md)s suggested for the original term. |
| [isEmpty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#isempty)() | Returns true if this set of suggested terms is empty. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### empty
- empty: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns true if this set of suggested terms is empty.
---
### firstTerm
- firstTerm: [SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md) `(read-only)`
- : This method returns the suggested term which is considered best matching
with the original term. See [getTerms()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getterms) for a note on ordering of
suggested terms.
**See Also:**
- [getOriginalTerm()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getoriginalterm)
- [getTerms()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getterms)
---
### originalTerm
- originalTerm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the original term of the user input, for which this instance
provides a list of suggested terms. Suggested terms can either be corrected,
or completed or exact matching.
---
### terms
- terms: [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md) `(read-only)`
- : Returns the list of [SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md)s suggested for the original term.
**See Also:**
- [getOriginalTerm()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getoriginalterm)
- [isEmpty()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#isempty)
---
## Method Details
### getFirstTerm()
- getFirstTerm(): [SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md)
- : This method returns the suggested term which is considered best matching
with the original term. See [getTerms()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getterms) for a note on ordering of
suggested terms.
**Returns:**
- the best matching term
**See Also:**
- [getOriginalTerm()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getoriginalterm)
- [getTerms()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getterms)
---
### getOriginalTerm()
- getOriginalTerm(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the original term of the user input, for which this instance
provides a list of suggested terms. Suggested terms can either be corrected,
or completed or exact matching.
**Returns:**
- the original unmodified term of the user input search phrase
---
### getTerms()
- getTerms(): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)
- : Returns the list of [SuggestedTerm](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerm.md)s suggested for the original term.
**Returns:**
- a iterator of suggested terms, might be empty
**See Also:**
- [getOriginalTerm()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#getoriginalterm)
- [isEmpty()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#isempty)
---
### isEmpty()
- isEmpty(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns true if this set of suggested terms is empty.
**Returns:**
- true if no suggested term is contained in this set, false otherwise
---
# Class Suggestions
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.suggest.Suggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md)
This is the base class for suggestions containers.
For each type of items, a sub class provides methods to
access the actual items.
See the sub classes for more specific information.
## All Known Subclasses
[BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md), [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md), [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md), [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md), [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md)
## Property Summary
| Property | Description |
| --- | --- |
| [searchPhraseSuggestions](#searchphrasesuggestions): [SearchPhraseSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SearchPhraseSuggestions.md) `(read-only)` | Returns the suggested search phrases that are associated to this suggestions. |
| ~~[suggestedPhrases](#suggestedphrases): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~ `(read-only)` | Returns a list of [SuggestedPhrase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md) objects that relates to the user input search phrase. |
| ~~[suggestedTerms](#suggestedterms): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~ `(read-only)` | Returns a list of [SuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) objects. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getSearchPhraseSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions)() | Returns the suggested search phrases that are associated to this suggestions. |
| ~~[getSuggestedPhrases](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsuggestedphrases)()~~ | Returns a list of [SuggestedPhrase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md) objects that relates to the user input search phrase. |
| ~~[getSuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsuggestedterms)()~~ | Returns a list of [SuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) objects. |
| ~~[hasSuggestedPhrases](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestedphrases)()~~ | Returns whether this suggestions container has any suggested phrases. |
| ~~[hasSuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestedterms)()~~ | Returns whether this suggestions container has any suggested terms. |
| [hasSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestions)() | Returns whether this suggestions container has any suggested items, i.e. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### searchPhraseSuggestions
- searchPhraseSuggestions: [SearchPhraseSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SearchPhraseSuggestions.md) `(read-only)`
- : Returns the suggested search phrases that are associated to this suggestions.
In contrast to the suggested items, the suggested phrases contains the corrected and
completed versions of the original search phrase.
---
### suggestedPhrases
- ~~suggestedPhrases: [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~ `(read-only)`
- : Returns a list of [SuggestedPhrase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md) objects that relates to the
user input search phrase.
**See Also:**
- [hasSuggestedPhrases()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestedphrases)
**Deprecated:**
**warning:** Please use method [getSearchPhraseSuggestions()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
---
### suggestedTerms
- ~~suggestedTerms: [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~ `(read-only)`
- : Returns a list of [SuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) objects. Each of the returned
instances represents a set of terms suggested for a particular single term
of the user input search phrase.
**Deprecated:**
**warning:** Please use method [getSearchPhraseSuggestions()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
---
## Method Details
### getSearchPhraseSuggestions()
- getSearchPhraseSuggestions(): [SearchPhraseSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SearchPhraseSuggestions.md)
- : Returns the suggested search phrases that are associated to this suggestions.
In contrast to the suggested items, the suggested phrases contains the corrected and
completed versions of the original search phrase.
**Returns:**
- the suggested search phrases for this suggestions
---
### getSuggestedPhrases()
- ~~getSuggestedPhrases(): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~
- : Returns a list of [SuggestedPhrase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md) objects that relates to the
user input search phrase.
**Returns:**
- a list of [SuggestedPhrase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md)s
**See Also:**
- [hasSuggestedPhrases()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestedphrases)
**Deprecated:**
**warning:** Please use method [getSearchPhraseSuggestions()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
---
### getSuggestedTerms()
- ~~getSuggestedTerms(): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~
- : Returns a list of [SuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) objects. Each of the returned
instances represents a set of terms suggested for a particular single term
of the user input search phrase.
**Returns:**
- a list of [SuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) for each term of the user input search phrase
**Deprecated:**
**warning:** Please use method [getSearchPhraseSuggestions()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
---
### hasSuggestedPhrases()
- ~~hasSuggestedPhrases(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~
- : Returns whether this suggestions container has any suggested phrases.
Note that this method only looks for suggested phrases. It does not account
for suggested terms or suggested objects. In other words,
even if there are suggested terms or objects, this method
will return false if this suggestions container has no phrases.
**Returns:**
- true only if there are phrases available
**Deprecated:**
**warning:** Please use method [getSearchPhraseSuggestions()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
---
### hasSuggestedTerms()
- ~~hasSuggestedTerms(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~
- : Returns whether this suggestions container has any suggested terms.
Note that this method checks suggested terms only,
but not suggested phrases or suggested objects.
**Returns:**
- true only if there are terms available
**Deprecated:**
**warning:** Please use method [getSearchPhraseSuggestions()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
---
### hasSuggestions()
- hasSuggestions(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns whether this suggestions container has any suggested items, i.e. products.
Note that this method only looks for concrete suggested items. It does not account
for suggested terms. In other words, even if there are suggested terms, this method
will return false if no matching items, like products or categories, were found
for the suggested terms.
To find out whether there are suggested terms and how they match with respect to
the original search phrase, one can use [getSuggestedTerms()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsuggestedterms) to obtain
a list of [SuggestedTerms](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md).
**Returns:**
- true only if there are items found using the suggested terms
**See Also:**
- [getSuggestedTerms()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsuggestedterms)
- [SuggestedTerms.isEmpty()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#isempty)
---
# Class SuggestModel
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.suggest.SuggestModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md)
The Suggest model provides methods and functions
to access search suggestions.
The search suggestion feature basically covers two functional areas.
First is just to suggest words, based on the users input,
utilizing spell correction or prediction (also known as auto completion).
The second functional area is also often referred to as search-as-you-type,
where, based on the users input, specific items are
already looked up, before the user actually has completed typing a word
or even fired up the search.
This model combines both functional areas and provides access to both - the
suggested words and the items found while using the predicted words.
This model supports various types of items that are being suggested, like
products, categories, brands, content pages as well merchant provided search phrases.
For each type, there is a [Suggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md) implementation
available and accessible through this model: [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md),
[CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md), [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md), [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md),
and [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md).
For each type of suggestions, the actual suggested items (like
products) can by obtained, and, on the other hand, a list of terms
is provided which were used to lookup the found items.
The terms can be used to present a advanced user experience in the
storefront, e.g. show auto completed words, spell corrections and so on.
The SuggestModel script API will always create suggestions with Autocorrections
regardless of the value of "Search Autocorrections" search preference.
## Constant Summary
| Constant | Description |
| --- | --- |
| [MAX_SUGGESTIONS](#max_suggestions): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 10 | The maximum number of suggestions that can be obtain from this model: `10` |
## Property Summary
| Property | Description |
| --- | --- |
| [brandSuggestions](#brandsuggestions): [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md) `(read-only)` | Returns a [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md) container for the current search phrase. |
| [categorySuggestions](#categorysuggestions): [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md) `(read-only)` | Returns a [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md) container for the current search phrase. |
| [contentSuggestions](#contentsuggestions): [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md) `(read-only)` | Returns a [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md) container for the current search phrase. |
| [customSuggestions](#customsuggestions): [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md) `(read-only)` | Returns a [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md) container for the current search phrase. |
| [effectiveSearchMode](#effectivesearchmode): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the effective search mode that was used for the last suggestion execution. |
| [filteredByFolder](#filteredbyfolder): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) | The method returns true, if the search suggestions are filtered by the folder. |
| [popularSearchPhrases](#popularsearchphrases): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md) `(read-only)` | Use this method to obtain a list of search phrases that currently are very popular among all users across the Site. |
| [productSuggestions](#productsuggestions): [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md) `(read-only)` | Returns a [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md) container for the current search phrase. |
| [recentSearchPhrases](#recentsearchphrases): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md) `(read-only)` | Use this method to obtain a list of personalized search phrases that the current user entered recently. |
| [searchMode](#searchmode): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Returns the search mode that was requested for the next suggestion execution via [setSearchMode(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchmodestring), or `null` if no mode was explicitly requested. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [SuggestModel](#suggestmodel)() | Constructs a new SuggestModel. |
## Method Summary
| Method | Description |
| --- | --- |
| [addRefinementValues](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#addrefinementvaluesstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Adds a refinement for product suggestions. |
| [getBrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#getbrandsuggestions)() | Returns a [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md) container for the current search phrase. |
| [getCategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#getcategorysuggestions)() | Returns a [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md) container for the current search phrase. |
| [getContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#getcontentsuggestions)() | Returns a [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md) container for the current search phrase. |
| [getCustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#getcustomsuggestions)() | Returns a [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md) container for the current search phrase. |
| [getEffectiveSearchMode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#geteffectivesearchmode)() | Returns the effective search mode that was used for the last suggestion execution. |
| [getPopularSearchPhrases](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#getpopularsearchphrases)() | Use this method to obtain a list of search phrases that currently are very popular among all users across the Site. |
| [getProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#getproductsuggestions)() | Returns a [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md) container for the current search phrase. |
| [getRecentSearchPhrases](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#getrecentsearchphrases)() | Use this method to obtain a list of personalized search phrases that the current user entered recently. |
| [getSearchMode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#getsearchmode)() | Returns the search mode that was requested for the next suggestion execution via [setSearchMode(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchmodestring), or `null` if no mode was explicitly requested. |
| [isFilteredByFolder](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#isfilteredbyfolder)() | The method returns true, if the search suggestions are filtered by the folder. |
| [removeRefinementValues](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#removerefinementvaluesstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Removes a refinement. |
| [setCategoryID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setcategoryidstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Apply a category ID to filter product, brand and category suggestions. |
| [setFilteredByFolder](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setfilteredbyfolderboolean)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)) | Set a flag to indicate if the search suggestions filter for elements that do not belong to a folder. |
| [setMaxSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Use this method to setup the maximum number of returned suggested items. |
| [setRefinementValues](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setrefinementvaluesstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets product suggestion refinement values for an attribute. |
| [setSearchMode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchmodestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets the search mode for the next suggestion execution. |
| [setSearchPhrase](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets the user input search phrase. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### MAX_SUGGESTIONS
- MAX_SUGGESTIONS: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 10
- : The maximum number of suggestions that can be obtain from this model: `10`
---
## Property Details
### brandSuggestions
- brandSuggestions: [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md) `(read-only)`
- : Returns a [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md) container for the current search phrase.
The [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md) container provides access to the found brands (if any) and
the terms suggested by the system with respect to the known product brands in the catalog.
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### categorySuggestions
- categorySuggestions: [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md) `(read-only)`
- : Returns a [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md) container for the current search phrase.
The [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md) container provides access to the found categories (if any) and
the terms suggested by the system with respect to the known categories in the catalog.
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### contentSuggestions
- contentSuggestions: [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md) `(read-only)`
- : Returns a [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md) container for the current search phrase.
The [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md) container provides access to the found content pages (if any) and
the terms suggested by the system with respect to the known content in the library.
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### customSuggestions
- customSuggestions: [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md) `(read-only)`
- : Returns a [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md) container for the current search phrase.
The [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md) container provides access to matching
custom phrases (if any) and the terms suggested
by the system with respect to the merchant provided custom phrases.
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### effectiveSearchMode
- effectiveSearchMode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the effective search mode that was used for the last suggestion execution. This reflects the actual
matching approach that ran, which may differ from the requested mode if a fallback occurred. Returns `null`
if no suggestions have been executed yet.
---
### filteredByFolder
- filteredByFolder: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : The method returns true, if the search suggestions are filtered by the folder. If this returns true it is not
possible for search suggestions to contain Page Designer content as it belongs to no folder.
---
### popularSearchPhrases
- popularSearchPhrases: [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md) `(read-only)`
- : Use this method to obtain a list of search phrases
that currently are very popular among all users across the Site.
The search phrases are specific to the region (based on user's IP address),
language (locale) and the user's browser type (agent).
---
### productSuggestions
- productSuggestions: [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md) `(read-only)`
- : Returns a [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md) container for the current search phrase.
The [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md) container provides access to the found products (if any) and
the terms suggested by the system with respect to the known products in the catalog.
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### recentSearchPhrases
- recentSearchPhrases: [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md) `(read-only)`
- : Use this method to obtain a list of personalized search phrases
that the current user entered recently.
The user is being identified by the CQuotient tracking cookie.
---
### searchMode
- searchMode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the search mode that was requested for the next suggestion execution via [setSearchMode(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchmodestring),
or `null` if no mode was explicitly requested. This reflects the caller's requested preference, not the
mode that actually ran — the requested mode is non-authoritative and `"semantic"` may still be demoted to
`"lexical"` by the search router. Use [getEffectiveSearchMode()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#geteffectivesearchmode) to obtain the mode that was
actually used.
---
## Constructor Details
### SuggestModel()
- SuggestModel()
- : Constructs a new SuggestModel.
---
## Method Details
### addRefinementValues(String, String)
- addRefinementValues(attributeID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), values: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Adds a refinement for product suggestions.
The method can be called to add an additional query
parameter specified as name-value pair. The values string may encode
multiple values delimited by the pipe symbol ('|').
**Parameters:**
- attributeID - The ID of the refinement attribute.
- values - the refinement value to set
---
### getBrandSuggestions()
- getBrandSuggestions(): [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md)
- : Returns a [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md) container for the current search phrase.
The [BrandSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md) container provides access to the found brands (if any) and
the terms suggested by the system with respect to the known product brands in the catalog.
**Returns:**
- a brand suggestions container for the current search phrase,
returns `null` for insufficient search input
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### getCategorySuggestions()
- getCategorySuggestions(): [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md)
- : Returns a [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md) container for the current search phrase.
The [CategorySuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md) container provides access to the found categories (if any) and
the terms suggested by the system with respect to the known categories in the catalog.
**Returns:**
- a category suggestions container for the current search phrase,
returns `null` for insufficient search input
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### getContentSuggestions()
- getContentSuggestions(): [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md)
- : Returns a [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md) container for the current search phrase.
The [ContentSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md) container provides access to the found content pages (if any) and
the terms suggested by the system with respect to the known content in the library.
**Returns:**
- a content suggestions container for the current search phrase,
returns `null` for insufficient search input
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### getCustomSuggestions()
- getCustomSuggestions(): [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md)
- : Returns a [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md) container for the current search phrase.
The [CustomSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md) container provides access to matching
custom phrases (if any) and the terms suggested
by the system with respect to the merchant provided custom phrases.
**Returns:**
- a custom suggestions container for the current search phrase,
returns `null` for insufficient search input
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### getEffectiveSearchMode()
- getEffectiveSearchMode(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the effective search mode that was used for the last suggestion execution. This reflects the actual
matching approach that ran, which may differ from the requested mode if a fallback occurred. Returns `null`
if no suggestions have been executed yet.
**Returns:**
- `"semantic"` if the query ran against the external search provider, `"lexical"` if it ran
against the native search, or `null` if no suggestions have been executed yet
---
### getPopularSearchPhrases()
- getPopularSearchPhrases(): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)
- : Use this method to obtain a list of search phrases
that currently are very popular among all users across the Site.
The search phrases are specific to the region (based on user's IP address),
language (locale) and the user's browser type (agent).
**Returns:**
- a list of personalized popular search phrases
---
### getProductSuggestions()
- getProductSuggestions(): [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md)
- : Returns a [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md) container for the current search phrase.
The [ProductSuggestions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md) container provides access to the found products (if any) and
the terms suggested by the system with respect to the known products in the catalog.
**Returns:**
- a product suggestions container for the current search phrase,
returns `null` for insufficient search input
**See Also:**
- [setMaxSuggestions(Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setmaxsuggestionsnumber)
- [setSearchPhrase(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchphrasestring)
---
### getRecentSearchPhrases()
- getRecentSearchPhrases(): [Iterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)
- : Use this method to obtain a list of personalized search phrases
that the current user entered recently.
The user is being identified by the CQuotient tracking cookie.
**Returns:**
- a list of recent search phrases of the current user
---
### getSearchMode()
- getSearchMode(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the search mode that was requested for the next suggestion execution via [setSearchMode(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#setsearchmodestring),
or `null` if no mode was explicitly requested. This reflects the caller's requested preference, not the
mode that actually ran — the requested mode is non-authoritative and `"semantic"` may still be demoted to
`"lexical"` by the search router. Use [getEffectiveSearchMode()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#geteffectivesearchmode) to obtain the mode that was
actually used.
**Returns:**
- `"semantic"` or `"lexical"` if a mode was requested, or `null` if no mode was requested
---
### isFilteredByFolder()
- isFilteredByFolder(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : The method returns true, if the search suggestions are filtered by the folder. If this returns true it is not
possible for search suggestions to contain Page Designer content as it belongs to no folder.
**Returns:**
- True if search suggestions are filtered by the folder of the content asset.
---
### removeRefinementValues(String, String)
- removeRefinementValues(attributeID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), values: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Removes a refinement. The method can be called to remove previously added
refinement values. The values string may encode multiple values delimited
by the pipe symbol ('|').
**Parameters:**
- attributeID - The ID of the refinement attribute.
- values - the refinement value to remove or null to remove all values
---
### setCategoryID(String)
- setCategoryID(categoryID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Apply a category ID to filter product, brand and category suggestions.
Suggested products, brands and categories, as well as corrected and completed
terms are specific to the given category or one of it's sub categories.
For example, in the specified category "television", the search term "pla"
will be auto completed to "plasma" (instead of e.g. "player") and
only televisions will be included in the list of suggested products.
**Parameters:**
- categoryID - the category to filter suggestions for
---
### setFilteredByFolder(Boolean)
- setFilteredByFolder(filteredByFolder: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): void
- : Set a flag to indicate if the search suggestions filter for elements that do not belong to a folder.
Must be set to false to return content assets that do not belong to any folder.
**Parameters:**
- filteredByFolder - filter the search suggestions by folder
---
### setMaxSuggestions(Number)
- setMaxSuggestions(maxSuggestions: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void
- : Use this method to setup the maximum number of returned suggested
items. For example, set this to 3 in order to only retrieve the
3 most relevant suggested products.
The maximum number of suggestions that can be queried are defined as [MAX_SUGGESTIONS](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestModel.md#max_suggestions).
**Parameters:**
- maxSuggestions - the number of suggested items to be returned by this model instance
---
### setRefinementValues(String, String)
- setRefinementValues(attributeID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), values: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Sets product suggestion refinement values for an attribute.
The method can be called to set
an additional query parameter specified as name-value pair. The value
string may encode multiple values delimited by the pipe symbol ('|').
Existing refinement values for the attribute will be removed.
**Parameters:**
- attributeID - The ID of the refinement attribute.
- values - the refinement values to set (delimited by '|') or null to remove all values
---
### setSearchMode(String)
- setSearchMode(mode: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Sets the search mode for the next suggestion execution. The mode influences the routing decision made by the
search router, but is non-authoritative — `"semantic"` still runs the full routing cascade and may be
demoted to `"lexical"` based on availability and query characteristics.
**Parameters:**
- mode - the search mode to request, either `"semantic"` or `"lexical"`
**Throws:**
- IllegalArgumentException - if the mode is not one of the allowed values
---
### setSearchPhrase(String)
- setSearchPhrase(searchPhrase: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Sets the user input search phrase. This search phrase is being processed
by applying auto completion, spell correction and enhancement with alternative
similar search terms.
The resulting search phrase is used to lookup the actual items,
like products or categories (search-as-you-type).
In order to access the processed terms, one can use the
[SearchPhraseSuggestions.getSuggestedTerms()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SearchPhraseSuggestions.md#getsuggestedterms) method of each of the respective
results returned by the methods in this model.
**Parameters:**
- searchPhrase - the user input search phrase
**See Also:**
- [SearchPhraseSuggestions.getSuggestedTerms()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SearchPhraseSuggestions.md#getsuggestedterms)
---
# Class SumItem
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.order.SumItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md)
Container used to represent an subtotal or grandtotal item which contains various prices and a tax breakdown
held in a collection of tax-items.
**Usage example:**
```
var invoice : Invoice = ...;
var productNet = invoice.productSubTotal.netPrice;
var serviceNet = invoice.serviceSubTotal.netPrice;
var grandNet = invoice.grandTotal.netPrice;
var grandTax = invoice.grandTotal.tax;
var grandGross = invoice.grandTotal.grossPrice;
# tax breakdown
for each(taxItem : TaxItem in invoice.grandTotal.taxItems) {
var tax : Money = taxItem.amount;
var taxGroup : TaxGroup = taxItem.taxGroup;
var rate : Double = taxGroup.rate;
var caption :String = taxGroup.caption;
var taxType :String = taxGroup.taxType;
}
```
## Property Summary
| Property | Description |
| --- | --- |
| [grossPrice](#grossprice): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)` | Gross price of SumItem. |
| [netPrice](#netprice): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)` | Net price of SumItem. |
| [tax](#tax): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)` | Total tax for SumItem. |
| [taxBasis](#taxbasis): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)` | Price of entire SumItem on which tax calculation is based. |
| [taxItems](#taxitems): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Tax items representing a tax breakdown for the SumItem. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getGrossPrice](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#getgrossprice)() | Gross price of SumItem. |
| [getNetPrice](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#getnetprice)() | Net price of SumItem. |
| [getTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#gettax)() | Total tax for SumItem. |
| [getTaxBasis](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#gettaxbasis)() | Price of entire SumItem on which tax calculation is based. |
| [getTaxItems](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#gettaxitems)() | Tax items representing a tax breakdown for the SumItem. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### grossPrice
- grossPrice: [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)`
- : Gross price of SumItem.
---
### netPrice
- netPrice: [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)`
- : Net price of SumItem.
---
### tax
- tax: [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)`
- : Total tax for SumItem.
---
### taxBasis
- taxBasis: [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)`
- : Price of entire SumItem on which tax calculation is based. Same as [getNetPrice()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#getnetprice)
or [getGrossPrice()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#getgrossprice) depending on whether the order is based on net or gross prices.
---
### taxItems
- taxItems: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Tax items representing a tax breakdown for the SumItem.
**See Also:**
- [TaxItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxItem.md)
---
## Method Details
### getGrossPrice()
- getGrossPrice(): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md)
- : Gross price of SumItem.
**Returns:**
- Gross price of SumItem.
---
### getNetPrice()
- getNetPrice(): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md)
- : Net price of SumItem.
**Returns:**
- Net price of SumItem.
---
### getTax()
- getTax(): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md)
- : Total tax for SumItem.
**Returns:**
- Total tax for SumItem.
---
### getTaxBasis()
- getTaxBasis(): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md)
- : Price of entire SumItem on which tax calculation is based. Same as [getNetPrice()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#getnetprice)
or [getGrossPrice()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.SumItem.md#getgrossprice) depending on whether the order is based on net or gross prices.
**Returns:**
- Price of entire item on which tax calculation is based
---
### getTaxItems()
- getTaxItems(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Tax items representing a tax breakdown for the SumItem.
**Returns:**
- tax items representing a tax breakdown for the SumItem
**See Also:**
- [TaxItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxItem.md)
---
# Class Symbol
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
Symbol is a primitive data type that can serve as object properties.
Symbol instance can be created explicitly or via a global registry, see [for(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md#forstring---variant-1).
**API Version:**
**note:** Available from version 21.2.
## Constant Summary
| Constant | Description |
| --- | --- |
| [hasInstance](#hasinstance): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by `instanceof`. |
| [isConcatSpreadable](#isconcatspreadable): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by [Array.concat(Object...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md#concatobject). |
| [iterator](#iterator): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by `for...of`. |
| [match](#match): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by [String.match(RegExp)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#matchregexp). |
| [replace](#replace): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by `String.replace()`. |
| [search](#search): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by [String.search(RegExp)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#searchregexp). |
| [species](#species): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used to create derived objects. |
| [split](#split): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by `String.split()`. |
| [toPrimitive](#toprimitive): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used to convert an object to a primitive value. |
| [toStringTag](#tostringtag): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by [Object.toString()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring). |
| [unscopables](#unscopables): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md) | The symbol used by `with`. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Symbol](#symbol)() | Creates a new symbol. |
| [Symbol](#symbolstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a new symbol. |
## Method Summary
| Method | Description |
| --- | --- |
| static [for](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md#forstring---variant-1)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Obtains a symbol from the global registry. |
| static [keyFor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md#keyforsymbol)([Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)) | Returns the key within the global symbol registry under which the given symbol is stored. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### hasInstance
- hasInstance: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by `instanceof`.
---
### isConcatSpreadable
- isConcatSpreadable: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by [Array.concat(Object...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md#concatobject).
---
### iterator
- iterator: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by `for...of`.
---
### match
- match: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by [String.match(RegExp)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#matchregexp).
---
### replace
- replace: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by `String.replace()`.
---
### search
- search: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by [String.search(RegExp)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#searchregexp).
---
### species
- species: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used to create derived objects.
---
### split
- split: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by `String.split()`.
---
### toPrimitive
- toPrimitive: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used to convert an object to a primitive value.
---
### toStringTag
- toStringTag: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by [Object.toString()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring).
---
### unscopables
- unscopables: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : The symbol used by `with`.
---
## Constructor Details
### Symbol()
- Symbol()
- : Creates a new symbol. Note that it must be called without `new`.
Symbols created via this method are always distinct.
---
### Symbol(String)
- Symbol(description: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Creates a new symbol. Note that it must be called without `new`.
Symbols created via this method are always distinct.
**Parameters:**
- description - A description for this symbol.
---
## Method Details
### for(String) - Variant 1
- static for(key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)
- : Obtains a symbol from the global registry. If no symbol exists for the key within the registry a new symbol is
created and stored in the global registry.
**Parameters:**
- key - The key for a symbol within the global registry.
**Returns:**
- The found or newly created symbol.
**API Version:**
**note:** Available from version 21.2.
---
### keyFor(Symbol)
- static keyFor(symbol: [Symbol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Symbol.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the key within the global symbol registry under which the given symbol is stored.
**Parameters:**
- symbol - The symbol to look for.
**Returns:**
- The key for the given symbol if the symbol is known to the global registry, else return `undefined`.
---
# Class SyntaxError
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Error](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md)
- [TopLevel.SyntaxError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.SyntaxError.md)
Represents a syntax error.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [SyntaxError](#syntaxerror)() | Constructs the error. |
| [SyntaxError](#syntaxerrorstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs the error with the specified message. |
## Method Summary
### Methods inherited from class Error
[captureStackTrace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#capturestacktraceerror-function), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#tostring)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### SyntaxError()
- SyntaxError()
- : Constructs the error.
---
### SyntaxError(String)
- SyntaxError(msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs the error with the
specified message.
**Parameters:**
- msg - the syntax error message.
---
# Class System
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.system.System](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md)
Represents the Commerce Cloud Digital server instance. An application server instance is configured to be of one of three types,
"development system", "staging system" or "production system".
## Constant Summary
| Constant | Description |
| --- | --- |
| [DEVELOPMENT_SYSTEM](#development_system): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0 | Represents the development system. |
| [PRODUCTION_SYSTEM](#production_system): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2 | Represents the production system. |
| [STAGING_SYSTEM](#staging_system): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | Represents the staging system. |
## Property Summary
| Property | Description |
| --- | --- |
| [calendar](#calendar): [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md) `(read-only)` | Returns a new Calendar object in the time zone of the current instance. |
| [compatibilityMode](#compatibilitymode): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the compatibility mode of the custom code version that is currently active. |
| [instanceHostname](#instancehostname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns instance hostname. |
| [instanceTimeZone](#instancetimezone): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the instance time zone. |
| [instanceType](#instancetype): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the type of the instance. |
| [preferences](#preferences): [OrganizationPreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.OrganizationPreferences.md) `(read-only)` | This method returns a container of all global preferences of this organization (instance). |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [getCalendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#getcalendar)() | Returns a new Calendar object in the time zone of the current instance. |
| static [getCompatibilityMode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#getcompatibilitymode)() | Returns the compatibility mode of the custom code version that is currently active. |
| static [getInstanceHostname](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#getinstancehostname)() | Returns instance hostname. |
| static [getInstanceTimeZone](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#getinstancetimezone)() | Returns the instance time zone. |
| static [getInstanceType](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#getinstancetype)() | Returns the type of the instance. |
| static [getPreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#getpreferences)() | This method returns a container of all global preferences of this organization (instance). |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### DEVELOPMENT_SYSTEM
- DEVELOPMENT_SYSTEM: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0
- : Represents the development system.
---
### PRODUCTION_SYSTEM
- PRODUCTION_SYSTEM: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2
- : Represents the production system.
---
### STAGING_SYSTEM
- STAGING_SYSTEM: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : Represents the staging system.
---
## Property Details
### calendar
- calendar: [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md) `(read-only)`
- : Returns a new Calendar object in the time zone of the
current instance.
---
### compatibilityMode
- compatibilityMode: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the compatibility mode of the custom code version that is currently active. The compatibility mode is
returned as a number, e.g. compatibility mode "15.5" is returned as 1505.
---
### instanceHostname
- instanceHostname: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns instance hostname.
---
### instanceTimeZone
- instanceTimeZone: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the instance time zone. The instance time zone is the time zone in which global actions like jobs or
reporting are specified in the system. Keep in mind that the instance time zone is cached at the current session.
Changes will affect only new sessions.
---
### instanceType
- instanceType: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the type of the instance. An application server instance is configured to be of one of three types,
"development system", "staging system" or "production system".
This method returns a constant representing the instance type of **this**
application server.
**See Also:**
- [DEVELOPMENT_SYSTEM](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#development_system)
- [PRODUCTION_SYSTEM](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#production_system)
- [STAGING_SYSTEM](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#staging_system)
---
### preferences
- preferences: [OrganizationPreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.OrganizationPreferences.md) `(read-only)`
- : This method returns a container of all global preferences of this
organization (instance).
---
## Method Details
### getCalendar()
- static getCalendar(): [Calendar](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Calendar.md)
- : Returns a new Calendar object in the time zone of the
current instance.
**Returns:**
- a Calendar object in the time zone of the
instance.
---
### getCompatibilityMode()
- static getCompatibilityMode(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the compatibility mode of the custom code version that is currently active. The compatibility mode is
returned as a number, e.g. compatibility mode "15.5" is returned as 1505.
**Returns:**
- The currently active compatibility mode.
---
### getInstanceHostname()
- static getInstanceHostname(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns instance hostname.
**Returns:**
- instance hostname.
---
### getInstanceTimeZone()
- static getInstanceTimeZone(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the instance time zone. The instance time zone is the time zone in which global actions like jobs or
reporting are specified in the system. Keep in mind that the instance time zone is cached at the current session.
Changes will affect only new sessions.
**Returns:**
- the instance time zone.
---
### getInstanceType()
- static getInstanceType(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the type of the instance. An application server instance is configured to be of one of three types,
"development system", "staging system" or "production system".
This method returns a constant representing the instance type of **this**
application server.
**Returns:**
- the instance type of the application server where this method was
called.
**See Also:**
- [DEVELOPMENT_SYSTEM](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#development_system)
- [PRODUCTION_SYSTEM](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#production_system)
- [STAGING_SYSTEM](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.System.md#staging_system)
---
### getPreferences()
- static getPreferences(): [OrganizationPreferences](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.OrganizationPreferences.md)
- : This method returns a container of all global preferences of this
organization (instance).
**Returns:**
- a preferences object containing all global system and custom
preferences of this instance
---
# Class SystemError
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Error](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md)
- [TopLevel.SystemError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.SystemError.md)
This error indicates an error in the system, which doesn't fall into
any of the other error categories like for example IOError. The SystemError
is always related to a systems internal Java exception. The class provides
access to some more details about this internal Java exception.
## Property Summary
| Property | Description |
| --- | --- |
| [causeFullName](#causefullname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | If the exception is associated with a root cause, the property contains the full name of the associated Java exception. |
| [causeMessage](#causemessage): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | If the exception is associated with a root cause, the property contains the message of the associated Java exception. |
| [causeName](#causename): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | If the exception is associated with a root cause, the property contains the simplified name of the associated Java exception. |
| [javaFullName](#javafullname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | The full name of the underlying Java exception. |
| [javaMessage](#javamessage): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | The message of the underlying Java exception. |
| [javaName](#javaname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | The simplified name of the underlying Java exception. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [SystemError](#systemerror)() | |
## Method Summary
### Methods inherited from class Error
[captureStackTrace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#capturestacktraceerror-function), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#tostring)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### causeFullName
- causeFullName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : If the exception is associated with a root cause, the property
contains the full name of the associated Java exception.
---
### causeMessage
- causeMessage: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : If the exception is associated with a root cause, the property
contains the message of the associated Java exception.
---
### causeName
- causeName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : If the exception is associated with a root cause, the property
contains the simplified name of the associated Java exception.
---
### javaFullName
- javaFullName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The full name of the underlying Java exception.
---
### javaMessage
- javaMessage: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The message of the underlying Java exception.
---
### javaName
- javaName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The simplified name of the underlying Java exception.
---
## Constructor Details
### SystemError()
- SystemError()
- :
---
# Class SystemObjectMgr
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.SystemObjectMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SystemObjectMgr.md)
Manager class which provides methods for querying of system objects with
meta data using the Commerce Cloud Digital query language. See individual API methods for
details on the query language.
Note: Other manager classes such as [CustomerMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerMgr.md),
[ProductMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductMgr.md), etc provide more specific and fine-grained
querying methods that can not be achieved using the general query language.
The following system object types are supported:
- GiftCertificate
- SourceCodeGroup
- Store
- ProductList
Support for the following system object types is deprecated:
- Order
- Profile
Use the search methods from [CustomerMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerMgr.md) and [OrderMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.OrderMgr.md),
respectively for querying these types.
To search for custom objects, use [CustomObjectMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomObjectMgr.md).
**Note:** this class allows access to sensitive information through
operations that retrieve the Profile and Order objects.
Pay attention to appropriate legal and regulatory requirements related to this data.
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [describe](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SystemObjectMgr.md#describestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the object type definition for the given system object type. |
| static [getAllSystemObjects](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SystemObjectMgr.md#getallsystemobjectsstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns all system objects of a specific type. |
| static [querySystemObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SystemObjectMgr.md#querysystemobjectstring-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) |
Searches for a single system object instance. |
| static [querySystemObjects](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SystemObjectMgr.md#querysystemobjectsstring-map-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) |
Searches for system object instances. |
| static [querySystemObjects](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.SystemObjectMgr.md#querysystemobjectsstring-string-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) |
Searches for system object instances. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Method Details
### describe(String)
- static describe(type: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [ObjectTypeDefinition](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ObjectTypeDefinition.md)
- : Returns the object type definition for the given system object type.
This method can be used for all system object types that are derived from ExtensibleObject.
**Parameters:**
- type - system object type whose type definition should be returned
**Returns:**
- the matching object type definition or `null` in case no
such type definition exists.
---
### getAllSystemObjects(String)
- static getAllSystemObjects(type: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [SeekableIterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SeekableIterator.md)
- : Returns all system objects of a specific type.
The following system object types are supported:
- GiftCertificate
- Order
- Profile
- SourceCodeGroup
- Store
- ProductList
The method throws an exception in case of another system type.
It is strongly recommended to call `close()` on the returned SeekableIterator
if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.
**Parameters:**
- type - The name of the system object type. If a matching type definition cannot be found for the given type a MetaDataException will be thrown.
**Returns:**
- SeekableIterator containing all system objects of a specific type.
**See Also:**
- [SeekableIterator.close()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SeekableIterator.md#close)
---
### querySystemObject(String, String, Object...)
- static querySystemObject(type: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), queryString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- :
Searches for a single system object instance. The following system object types are supported:
- GiftCertificate
- Order
- Profile
- SourceCodeGroup
- Store
- ProductList
The method throws an exception in case of another system type.
The search can be configured using a simple query language, which provides most common filter and operator
functionality.
The identifier for an **attribute** to use in a query condition is always the ID of the attribute as defined
in the type definition. For custom defined attributes the prefix custom is required in the search term (e.g.
`custom.color = {1}`), while for system attributes no prefix is used (e.g. `name = {4}`).
Supported attribute value **types** with sample expression values:
- _String_`'String', 'Str*', 'Strin?'`
- _Integer_`1, 3E4`
- _Number_`1.0, 3.99E5`
- _Date_`yyyy-MM-dd e.g. 2007-05-31 (Default TimeZone = UTC)`
- _DateTime_`yyyy-MM-dd'T'hh:mm:ss+Z e.g. 2007-05-31T00:00+Z (Z TimeZone = UTC) or 2007-05-31T00:00:00`
- _Boolean_`true, false`
- _Email_`'search@demandware.com', '*@demandware.com'`
- _Set of String_`'String', 'Str*', 'Strin?'`
- _Set of Integer_`1, 3E4`
- _Set of Number_`1.0, 3.99E5`
- _Enum of String_`'String', 'Str*', 'Strin?'`
- _Enum of Integer_`1, 3E4`
The following types of attributes are not queryable:
- _Image_
- _HTML_
- _Text_
- _Quantity_
- _Password_
Note, that some system attributes are not queryable by default regardless of the actual value type code.
The following **operators** are supported in a condition:
- `=`Equals - All types; supports NULL value (`thumbnail = NULL`)
- `!=`Not equals - All types; supports NULL value (`thumbnail != NULL`)
- `<`Less than - Integer, Number and Date types only
- `>`Greater than - Integer, Number and Date types only
- `<=`Less or equals than - Integer, Number and Date types only
- `>=`Greater or equals than - Integer, Number and Date types only
- `LIKE`Like - String types and Email only; use if leading or trailing wildcards will be used to support substring search(`custom.country LIKE 'US*'`)
- `ILIKE`Caseindependent Like - String types and Email only, use to support case insensitive query (`custom.country ILIKE 'usa'`), does also support wildcards for substring matching
Conditions can be combined using logical expressions 'AND', 'OR' and 'NOT' and nested using parenthesis e.g.
`gender = {1} AND (age >= {2} OR (NOT profession LIKE {3}))`.
The query language provides a placeholder syntax to pass objects as additional search parameters. Each passed
object is related to a placeholder in the query string. The placeholder must be an Integer that is surrounded by
braces. The first Integer value must be '0', the second '1' and so on, e.g.
`querySystemObjects("sample", "age = {0} or creationDate >= {1}", 18, date)`
If there is more than one object matching the specified query criteria, the result is not deterministic. In order
to retrieve a single object from a sorted result set it is recommended to use the following code:
`querySystemObjects("", "custom.myAttr asc", null).first()`. The method `first()` returns
only the next element and closes the iterator.
It is strongly recommended to call `close()` on the returned SeekableIterator if not all of its
elements are being processed. This will enable the cleanup of system resources.
This method does not consider locale specific attributes. It returns all objects by checking the default
non-localizable attributes. Any locale specific filtering after fetching the objects must be done by other custom
code.
Example: For store objects, such a locale specific filtering can be:
- Get the store objects using this method with non-localized attributes query.
- Access the `store.getCustom("myattr")`. It returns the localized value of the attribute.
**Parameters:**
- type - the system object type for the query.
- queryString - the actual query.
- args - optional parameters for the queryString.
**Returns:**
- the system object defined by `type` which was found when executing the
`queryString`.
**See Also:**
- [SeekableIterator.close()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SeekableIterator.md#close)
---
### querySystemObjects(String, Map, String)
- static querySystemObjects(type: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), queryAttributes: [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md), sortString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [SeekableIterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SeekableIterator.md)
- :
Searches for system object instances. The following system object types are supported:
- GiftCertificate
- Order
- Profile
- SourceCodeGroup
- Store
- ProductList
The method throws an exception in case of another system type.
The search can be configured with a map, which key-value pairs are converted into a query expression. The
key-value pairs are turned into a sequence of '=' or 'like' conditions, which are combined with AND statements.
Example:
A map with the key/value pairs: _'name'/'tom\*', 'age'/66_ will be converted as follows:
`"name like 'tom*' and age = 66"`
The identifier for an **attribute** to use in a query condition is always the ID of the attribute as defined
in the type definition. For custom defined attributes the prefix custom is required in the search term (e.g.
`custom.color = {1}`), while for system attributes no prefix is used (e.g. `name = {4}`).
Supported attribute value **types** with sample expression values:
- _String_`'String', 'Str*', 'Strin?'`
- _Integer_`1, 3E4`
- _Number_`1.0, 3.99E5`
- _Date_`yyyy-MM-dd e.g. 2007-05-31 (Default TimeZone = UTC)`
- _DateTime_`yyyy-MM-dd'T'hh:mm:ss+Z e.g. 2007-05-31T00:00+Z (Z TimeZone = UTC) or 2007-05-31T00:00:00`
- _Boolean_`true, false`
- _Email_`'search@demandware.com', '*@demandware.com'`
- _Set of String_`'String', 'Str*', 'Strin?'`
- _Set of Integer_`1, 3E4`
- _Set of Number_`1.0, 3.99E5`
- _Enum of String_`'String', 'Str*', 'Strin?'`
- _Enum of Integer_`1, 3E4`
The following types of attributes are not queryable:
- _Image_
- _HTML_
- _Text_
- _Quantity_
- _Password_
Note, that some system attributes are not queryable by default regardless of the actual value type code.
The **sorting** parameter is optional and may contain a comma separated list of attribute names to sort by.
Each sort attribute name may be followed by an optional sort direction specifier ('asc' | 'desc'). Default
sorting directions is ascending, if no direction was specified.
Example: `age desc, name`
Please note that specifying a localized custom attribute as the sorting attribute is currently not supported.
It is strongly recommended to call `close()` on the returned SeekableIterator if not all of its
elements are being retrieved. This will ensure the proper cleanup of system resources.
This method does not consider locale specific attributes. It returns all objects by checking the default
non-localizable attributes. Any locale specific filtering after fetching the objects must be done by other custom
code.
Example: For store objects, such a locale specific filtering can be:
- Get the store objects using this method with non-localized attributes query.
- Access the `store.getCustom("myattr")`. It returns the localized value of the attribute.
**Parameters:**
- type - the system object type for the query.
- queryAttributes - key-value pairs, which define the query.
- sortString - an optional sorting or null if no sorting is necessary.
**Returns:**
- SeekableIterator containing the result set of the query.
**See Also:**
- [SeekableIterator.close()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SeekableIterator.md#close)
---
### querySystemObjects(String, String, String, Object...)
- static querySystemObjects(type: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), queryString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), sortString: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [SeekableIterator](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SeekableIterator.md)
- :
Searches for system object instances. The following system object types are supported:
- GiftCertificate
- Order
- Profile
- SourceCodeGroup
- Store
- ProductList
The method throws an exception in case of another system type.
The search can be configured using a simple query language, which provides most common filter and operator
functionality.
The identifier for an **attribute** to use in a query condition is always the ID of the attribute as defined
in the type definition. For custom defined attributes the prefix custom is required in the search term (e.g.
`custom.color = {1}`), while for system attributes no prefix is used (e.g. `name = {4}`).
Supported attribute value **types** with sample expression values:
- _String_`'String', 'Str*', 'Strin?'`
- _Integer_`1, 3E4`
- _Number_`1.0, 3.99E5`
- _Date_`yyyy-MM-dd e.g. 2007-05-31 (Default TimeZone = UTC)`
- _DateTime_`yyyy-MM-dd'T'hh:mm:ss+Z e.g. 2007-05-31T00:00+Z (Z TimeZone = UTC) or 2007-05-31T00:00:00`
- _Boolean_`true, false`
- _Email_`'search@demandware.com', '*@demandware.com'`
- _Set of String_`'String', 'Str*', 'Strin?'`
- _Set of Integer_`1, 3E4`
- _Set of Number_`1.0, 3.99E5`
- _Enum of String_`'String', 'Str*', 'Strin?'`
- _Enum of Integer_`1, 3E4`
The following types of attributes are not queryable:
- _Image_
- _HTML_
- _Text_
- _Quantity_
- _Password_
Note, that some system attributes are not queryable by default regardless of the actual value type code.
The following **operators** are supported in a condition:
- `=`Equals - All types; supports NULL value (`thumbnail = NULL`)
- `!=`Not equals - All types; supports NULL value (`thumbnail != NULL`)
- `<`Less than - Integer, Number and Date types only
- `>`Greater than - Integer, Number and Date types only
- `<=`Less or equals than - Integer, Number and Date types only
- `>=`Greater or equals than - Integer, Number and Date types only
- `LIKE`Like - String types and Email only; use if leading or trailing wildcards will be used to support substring search(`custom.country LIKE 'US*'`)
- `ILIKE`Caseindependent Like - String types and Email only, use to support case insensitive query (`custom.country ILIKE 'usa'`), does also support wildcards for substring matching
Conditions can be combined using logical expressions 'AND', 'OR' and 'NOT' and nested using parenthesis e.g.
`gender = {1} AND (age >= {2} OR (NOT profession LIKE {3}))`.
The query language provides a placeholder syntax to pass objects as additional search parameters. Each passed
object is related to a placeholder in the query string. The placeholder must be an Integer that is surrounded by
braces. The first Integer value must be '0', the second '1' and so on, e.g.
`querySystemObjects("sample", "age = {0} or creationDate >= {1}", 18, date)`
The **sorting** parameter is optional and may contain a comma separated list of attribute names to sort by.
Each sort attribute name may be followed by an optional sort direction specifier ('asc' | 'desc'). Default
sorting directions is ascending, if no direction was specified.
Example: `age desc, name`
Please note that specifying a localized custom attribute as the sorting attribute is currently not supported.
Sometimes it is desired to get all instances of specified type with a special sorting condition. This can be
easily done by providing the 'type' of the system object and the 'sortString' in combination with an empty
'queryString', e.g. `querySystemObjects("sample", "", "ID asc")`
It is strongly recommended to call `close()` on the returned SeekableIterator if not all of its
elements are being retrieved. This will ensure the proper cleanup of system resources.
This method does not consider locale specific attributes. It returns all objects by checking the default
non-localizable attributes. Any locale specific filtering after fetching the objects must be done by other custom
code.
Example: For store objects, such a locale specific filtering can be:
- Get the store objects using this method with non-localized attributes query.
- Access the `store.getCustom("myattr")`. It returns the localized value of the attribute.
**Parameters:**
- type - the system object type for the query.
- queryString - the actual query.
- sortString - an optional sorting or null if no sorting is necessary.
- args - optional parameters for the queryString.
**Returns:**
- SeekableIterator containing the result set of the query.
**See Also:**
- [SeekableIterator.close()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.SeekableIterator.md#close)
---
# Class TaxGroup
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.order.TaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md)
Contains the formal definition of a tax including a type (it's just the key), a [percentage value](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md#getrate)
if provided, a [caption](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md#getcaption) and a [description](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md#getdescription).
## Property Summary
| Property | Description |
| --- | --- |
| [caption](#caption): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Gets the caption. |
| [description](#description): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Gets the description. |
| [rate](#rate): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Gets the percentage amount of the rate. |
| [taxType](#taxtype): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Gets the tax type. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md#createstring-string-string-decimal)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Decimal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Decimal.md)) | Creates a TaxGroup. |
| [getCaption](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md#getcaption)() | Gets the caption. |
| [getDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md#getdescription)() | Gets the description. |
| [getRate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md#getrate)() | Gets the percentage amount of the rate. |
| [getTaxType](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md#gettaxtype)() | Gets the tax type. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### caption
- caption: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Gets the caption.
---
### description
- description: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Gets the description.
---
### rate
- rate: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Gets the percentage amount of the rate.
---
### taxType
- taxType: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Gets the tax type.
---
## Method Details
### create(String, String, String, Decimal)
- static create(taxType: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), caption: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), description: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), taxRate: [Decimal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Decimal.md)): [TaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md)
- : Creates a TaxGroup.
This TaxGroup can be used for example in [ReturnItem.addTaxItem(Decimal, TaxGroup)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ReturnItem.md#addtaxitemdecimal-taxgroup).
**Parameters:**
- taxType - the tax type
- caption - the caption
- description - the description
- taxRate - the tax rate as floating point. `1.0` means 100 %.
**Returns:**
- the tax group
---
### getCaption()
- getCaption(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Gets the caption.
**Returns:**
- the caption
---
### getDescription()
- getDescription(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Gets the description.
**Returns:**
- the description
---
### getRate()
- getRate(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Gets the percentage amount of the rate.
**Returns:**
- the tax rate percentage value
---
### getTaxType()
- getTaxType(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Gets the tax type.
**Returns:**
- the tax type
---
# Class TaxHooks
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.order.hooks.TaxHooks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md)
This interface represents tax extension points for Commerce App tax providers.
These hooks provide integration points for external tax calculation services installed via the Commerce App
framework. They are distinct from the legacy `dw.order.calculateTax` extension point.
**IMPORTANT:** These hooks should **only** be implemented and registered by Commerce Apps
(applications installed via the Commerce App framework with a CAP file). They are not intended for custom merchant
cartridges or storefront implementations. Merchants who want custom tax calculation logic should use the legacy
`dw.order.calculateTax` extension point instead.
Hook Registration A function must be defined inside a JavaScript source and must be exported. The script
with the exported hook function must be located inside a site cartridge. Inside the site cartridge a
`package.json` file with a 'hooks' entry must exist:
```
"hooks": "./hooks.json"
```
The hooks entry links to a JSON file, relative to the `package.json` file. This file lists all registered
hooks inside the hooks property:
```
"hooks": [
{"name": "sfcc.app.tax.calculate", "script": "./calculate.js"},
{"name": "sfcc.app.tax.commit", "script": "./commit.js"},
{"name": "sfcc.app.tax.cancel", "script": "./cancel.js"}
]
```
A hook entry has a `name` and a `script` property:
- The `name`contains the extension point name (the hook name).
- The `script`contains the script path relative to the hooks file, with the exported hook function.
**Function Naming Convention:** The exported JavaScript function name must match the last segment of the
extension point name, for example, `calculate`, `commit`, `cancel`..
Order Lifecycle Context Each hook fires at a specific point in the order lifecycle:
- **calculate:**Fires during basket calculation on every basket operation (e.g., adding items, changing quantities, updating shipping). Calculates tax amounts for the basket line items.
- **commit:**Fires immediately after successful order creation (order status `CREATED`). Notifies the tax provider that the order has been created and tax amounts should be committed.
- **cancel:**Fires on order cancellation or failure. Notifies the tax provider to void or cancel previously committed tax amounts.
Hook Precedence
- When `sfcc.app.tax.calculate`is registered, it takes precedence over the legacy `dw.order.calculateTax`hook.
- If the Commerce App hook is not registered, the platform falls back to `dw.order.calculateTax`(if registered).
- If neither hook is available, the platform uses default platform tax calculation.
**Important:** If you override the `dw.order.calculate` hook (the parent basket calculation
hook), the platform's tax hook selection logic is bypassed entirely. In this case, if you want to use Commerce App
tax providers, you must manually invoke the `sfcc.app.tax.calculate` hook from within your custom
`dw.order.calculate` implementation.
SCAPI Behavior
SCAPI requests with `ScapiHookExecutionEnabled` disabled bypass all hooks (both Commerce App tax hooks and
the legacy `dw.order.calculateTax` hook) and go straight to the default platform tax calculation.
Hook Arguments and Return Types
- **calculate:**Receives a `dw.order.LineItemCtnr`(typically a `dw.order.Basket`) as the first argument. Must return a `dw.system.Status`object (or `null`for success).
- **commit:**Receives a `dw.order.Order`object as the first argument. Must return a `dw.system.Status`object (or `null`for success).
- **cancel:**Receives a `dw.order.Order`object as the first argument. Must return a `dw.system.Status`object (or `null`for success).
Error Handling
For calculate hook:
- **Always blocks on error:**Both returning a `Status.ERROR`and throwing an exception prevent the basket calculation from completing successfully. The platform logs the error and halts the current basket operation. Since order creation requires a successful basket calculation, this also prevents orders from being created with incorrect tax amounts.
For commit hook:
The Commerce App developer chooses whether errors should block order creation by how they handle errors in their hook
implementation:
- **Non-blocking error:**Catch exceptions and return a `Status.ERROR`. The platform logs the error as a warning and continues with the order lifecycle. Use this when the tax provider is temporarily unavailable but the order should still be created.
```
return new Status(Status.ERROR, 'TAX_COMMIT_FAILED', 'Details about the failure');
```
- **Blocking error:**Let exceptions propagate (don't catch them). The platform logs the error and rolls back the order lifecycle operation, preventing the order from being created.
```
throw new Error('Tax provider unavailable');
```
For cancel hook:
The Commerce App developer chooses whether errors should block order cancellation by how they handle errors in their
hook implementation:
- **Non-blocking error:**Catch exceptions and return a `Status.ERROR`. The platform logs the error as a warning and continues with the order lifecycle. Use this when the tax provider is temporarily unavailable but the order cancellation should still proceed.
```
return new Status(Status.ERROR, 'TAX_CANCEL_FAILED', 'Details about the failure');
```
- **Blocking error:**Let exceptions propagate (don't catch them). The platform logs the error and rolls back the order cancellation operation.
```
throw new Error('Tax provider unavailable');
```
## Constant Summary
| Constant | Description |
| --- | --- |
| [extensionPointAppCalculateTax](#extensionpointappcalculatetax): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "sfcc.app.tax.calculate" | The extension point name sfcc.app.tax.calculate. |
| [extensionPointAppCancelTax](#extensionpointappcanceltax): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "sfcc.app.tax.cancel" | The extension point name sfcc.app.tax.cancel. |
| [extensionPointAppCommitTax](#extensionpointappcommittax): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "sfcc.app.tax.commit" | The extension point name sfcc.app.tax.commit. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [calculate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#calculatelineitemctnr)([LineItemCtnr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.LineItemCtnr.md)) | The function is called by extension point [extensionPointAppCalculateTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#extensionpointappcalculatetax). |
| [cancel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#cancelorder)([Order](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Order.md)) | The function is called by extension point [extensionPointAppCancelTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#extensionpointappcanceltax) during OrderMgr.failOrder() or OrderMgr.cancelOrder(). |
| [commit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#commitorder)([Order](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Order.md)) | The function is called by extension point [extensionPointAppCommitTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#extensionpointappcommittax) during order creation in the order creation transaction. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### extensionPointAppCalculateTax
- extensionPointAppCalculateTax: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "sfcc.app.tax.calculate"
- : The extension point name sfcc.app.tax.calculate.
---
### extensionPointAppCancelTax
- extensionPointAppCancelTax: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "sfcc.app.tax.cancel"
- : The extension point name sfcc.app.tax.cancel.
---
### extensionPointAppCommitTax
- extensionPointAppCommitTax: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "sfcc.app.tax.commit"
- : The extension point name sfcc.app.tax.commit.
---
## Method Details
### calculate(LineItemCtnr)
- calculate(lineItemCtnr: [LineItemCtnr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.LineItemCtnr.md)): [Status](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md)
- : The function is called by extension point [extensionPointAppCalculateTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#extensionpointappcalculatetax). It calculates tax amounts for
the basket line items during basket calculation. This hook fires on every basket operation (e.g., adding items,
changing quantities, updating shipping), not only before order creation.
**Note:** If the `dw.order.calculate` hook is overridden, the platform's automatic tax
hook selection is bypassed. You must manually invoke this hook from within your custom
`dw.order.calculate` implementation if you want to use Commerce App tax providers.
**Error Handling:** Both returning a `Status.ERROR` and throwing an exception will
prevent the basket calculation from completing successfully. The platform logs the error and halts the current
basket operation. Since order creation requires a successful basket calculation, this also prevents orders from
being created with incorrect tax amounts.
**SCAPI Behavior:** When `ScapiHookExecutionEnabled` is disabled, SCAPI requests bypass
this hook and use default platform tax calculation.
**Sample Implementation:**
```
function calculate(basket) {
var TaxMgr = require('dw/order/TaxMgr');
var Status = require('dw/system/Status');
var HTTPClient = require('dw/net/HTTPClient');
// 1. Extract shipping address and line items
var shipment = basket.getDefaultShipment();
var shippingAddress = shipment.getShippingAddress();
// 2. Build request for external tax provider
var taxRequest = {
addresses: {
shipTo: {
line1: shippingAddress.getAddress1(),
city: shippingAddress.getCity(),
region: shippingAddress.getStateCode(),
country: shippingAddress.getCountryCode().getValue(),
postalCode: shippingAddress.getPostalCode()
}
},
lines: []
};
// Add product line items
var pliIterator = basket.getProductLineItems().iterator();
while (pliIterator.hasNext()) {
var pli = pliIterator.next();
taxRequest.lines.push({
itemCode: pli.getProductID(),
quantity: pli.getQuantityValue(),
amount: pli.getAdjustedPrice().getValue(),
taxCode: pli.getTaxClassID() // Product tax category
});
}
// 3. Call external tax service
var httpClient = new HTTPClient();
httpClient.open('POST', 'https://api.taxprovider.com/calculate');
httpClient.setRequestHeader('Authorization', 'Bearer ' + apiKey);
httpClient.send(JSON.stringify(taxRequest));
if (httpClient.statusCode !== 200) {
return new Status(Status.ERROR, 'TAX_CALC_FAILED', 'Tax calculation failed: ' + httpClient.errorText);
}
var taxResponse = JSON.parse(httpClient.text);
// 4. Apply tax amounts to basket line items using TaxMgr
taxResponse.lines.forEach(function(line, index) {
var pli = basket.getProductLineItems()[index];
TaxMgr.setProductLineTax(pli, line.tax);
});
// Set shipping tax if applicable
if (taxResponse.shippingTax) {
TaxMgr.setShippingTax(shipment, taxResponse.shippingTax);
}
return new Status(Status.OK);
}
exports.calculate = calculate;
```
**Common APIs used:** `dw.order.TaxMgr` (setProductLineTax, setShippingTax),
dw.net.HTTPClient, `dw.order.LineItemCtnr` (getProductLineItems, getShipments),
`dw.order.ProductLineItem` (getProductID, getTaxClassID), `dw.order.OrderAddress`
(getAddress1, getCity, getStateCode).
**Parameters:**
- lineItemCtnr - the line item container (basket) for which tax should be calculated.
**Returns:**
- `Status.OK` or `null` for success; `Status.ERROR` to block the basket
calculation with details about the failure. Throwing an exception will also block the basket calculation.
---
### cancel(Order)
- cancel(order: [Order](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Order.md)): [Status](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md)
- : The function is called by extension point [extensionPointAppCancelTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#extensionpointappcanceltax) during OrderMgr.failOrder() or
OrderMgr.cancelOrder(). It notifies the Commerce App tax provider that the order has been cancelled or has
failed, and that previously committed tax amounts should be voided or cancelled in the tax provider.
**Error Handling:**
- **Non-blocking error:**Return `Status.ERROR`. The platform logs the error as a warning and continues with the order lifecycle. Use this when the tax provider is temporarily unavailable but the order cancellation should still proceed.
- **Blocking error:**Throw an exception. The platform logs the error and rolls back the order lifecycle operation.
**SCAPI Behavior:** When `ScapiHookExecutionEnabled` is disabled, SCAPI requests bypass
this hook.
**Sample Implementation:**
```
function cancel(order) {
var Status = require('dw/system/Status');
var HTTPClient = require('dw/net/HTTPClient');
// 1. Retrieve the external transaction ID stored during commit
var taxProviderTransactionId = order.custom.taxProviderTransactionId;
if (!taxProviderTransactionId) {
// No transaction to cancel - tax was never committed
return new Status(Status.OK);
}
// 2. Build void/cancel request for external tax provider
var cancelRequest = {
code: order.getOrderNo(),
type: 'SalesInvoice'
};
// 3. Call external tax service to void/cancel the transaction
var httpClient = new HTTPClient();
httpClient.open('POST', 'https://api.taxprovider.com/transactions/' + taxProviderTransactionId + '/void');
httpClient.setRequestHeader('Authorization', 'Bearer ' + apiKey);
httpClient.send(JSON.stringify(cancelRequest));
if (httpClient.statusCode !== 200 && httpClient.statusCode !== 204) {
// Non-blocking error: log warning but allow order cancellation to proceed
return new Status(Status.ERROR, 'TAX_CANCEL_FAILED',
'Failed to void tax transaction in provider, order cancellation will proceed. Error: ' + httpClient.errorText);
}
return new Status(Status.OK);
}
exports.cancel = cancel;
```
**Common APIs used:** dw.net.HTTPClient, `dw.order.Order` (getOrderNo, custom
attributes), dw.system.Status.
**Parameters:**
- order - the order that has been cancelled and for which tax should be voided.
**Returns:**
- `Status.OK` or `null` for success; `Status.ERROR` to log a warning
without blocking the order cancellation. Throwing an exception will roll back the order cancellation
operation.
---
### commit(Order)
- commit(order: [Order](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Order.md)): [Status](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Status.md)
- : The function is called by extension point [extensionPointAppCommitTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.hooks.TaxHooks.md#extensionpointappcommittax) during order creation in the order
creation transaction. It notifies the Commerce App tax provider that the order has been successfully created and
that tax amounts should be committed to the tax provider. The order is in `CREATED` status at this
point (before being placed).
**Error Handling:**
- **Non-blocking error:**Return `Status.ERROR`. The platform logs the error as a warning and continues with the order lifecycle. Use this when the tax provider is temporarily unavailable but the order should still be created.
- **Blocking error:**Throw an exception. The platform logs the error and rolls back the order lifecycle operation, preventing the order from being created.
**SCAPI Behavior:** When `ScapiHookExecutionEnabled` is disabled, SCAPI requests bypass
this hook.
**Sample Implementation:**
```
function commit(order) {
var Transaction = require('dw/system/Transaction');
var Status = require('dw/system/Status');
var HTTPClient = require('dw/net/HTTPClient');
// 1. Build commit request for external tax provider
var commitRequest = {
code: order.getOrderNo(), // Use order number as unique transaction ID
type: 'SalesInvoice',
companyCode: 'DEFAULT',
date: order.getCreationDate(),
customerCode: order.getCustomerNo(),
addresses: {
shipTo: {
line1: order.getDefaultShipment().getShippingAddress().getAddress1(),
city: order.getDefaultShipment().getShippingAddress().getCity(),
region: order.getDefaultShipment().getShippingAddress().getStateCode(),
country: order.getDefaultShipment().getShippingAddress().getCountryCode().getValue(),
postalCode: order.getDefaultShipment().getShippingAddress().getPostalCode()
}
},
lines: [],
commit: true // Tell provider to commit the transaction
};
// Add order line items
var pliIterator = order.getProductLineItems().iterator();
while (pliIterator.hasNext()) {
var pli = pliIterator.next();
commitRequest.lines.push({
itemCode: pli.getProductID(),
quantity: pli.getQuantityValue(),
amount: pli.getAdjustedPrice().getValue(),
tax: pli.getAdjustedTax().getValue()
});
}
// 2. Call external tax service to commit transaction
var httpClient = new HTTPClient();
httpClient.open('POST', 'https://api.taxprovider.com/transactions');
httpClient.setRequestHeader('Authorization', 'Bearer ' + apiKey);
httpClient.send(JSON.stringify(commitRequest));
if (httpClient.statusCode !== 200 && httpClient.statusCode !== 201) {
// Non-blocking error: log warning but allow order to proceed
return new Status(Status.ERROR, 'TAX_COMMIT_FAILED',
'Failed to commit tax to provider, order will proceed. Error: ' + httpClient.errorText);
}
var commitResponse = JSON.parse(httpClient.text);
// 3. Store external transaction ID in order custom attribute for later reference (cancel/refund)
Transaction.wrap(function() {
order.custom.taxProviderTransactionId = commitResponse.id;
});
return new Status(Status.OK);
}
exports.commit = commit;
```
**Common APIs used:** dw.system.Transaction, dw.net.HTTPClient, `dw.order.Order`
(getOrderNo, getProductLineItems, getDefaultShipment, custom attributes), `dw.order.ProductLineItem`
(getAdjustedTax).
**Parameters:**
- order - the order that has been created and for which tax should be committed.
**Returns:**
- `Status.OK` or `null` for success; `Status.ERROR` to log a warning
without blocking the order. Throwing an exception will roll back the order creation.
---
# Class TaxItem
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.order.TaxItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxItem.md)
An item containing tax information allowing a tax breakdown between a number of [TaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md)s.
## Property Summary
| Property | Description |
| --- | --- |
| [amount](#amount): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)` | Gets the amount. |
| [taxGroup](#taxgroup): [TaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md) `(read-only)` | Returns the [tax group](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md). |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getAmount](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxItem.md#getamount)() | Gets the amount. |
| [getTaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxItem.md#gettaxgroup)() | Returns the [tax group](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md). |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### amount
- amount: [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md) `(read-only)`
- : Gets the amount.
---
### taxGroup
- taxGroup: [TaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md) `(read-only)`
- : Returns the [tax group](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md).
**See Also:**
- [TaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md)
---
## Method Details
### getAmount()
- getAmount(): [Money](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Money.md)
- : Gets the amount.
**Returns:**
- the amount
---
### getTaxGroup()
- getTaxGroup(): [TaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md)
- : Returns the [tax group](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md).
**Returns:**
- the tax rate
**See Also:**
- [TaxGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxGroup.md)
---
# Class TaxMgr
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.order.TaxMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md)
Provides methods to access the tax table.
## Constant Summary
| Constant | Description |
| --- | --- |
| [TAX_POLICY_GROSS](#tax_policy_gross): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0 | Constant representing the gross taxation policy. |
| [TAX_POLICY_NET](#tax_policy_net): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | Constant representing the net taxation policy. |
## Property Summary
| Property | Description |
| --- | --- |
| [customRateTaxClassID](#customratetaxclassid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the tax class that represents items with a custom tax rate. |
| [defaultTaxClassID](#defaulttaxclassid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the default tax class defined for the site. |
| [defaultTaxJurisdictionID](#defaulttaxjurisdictionid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the default tax jurisdiction defined for the site. |
| [taxExemptTaxClassID](#taxexempttaxclassid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the ID of the tax class that represents tax exempt items. |
| [taxationPolicy](#taxationpolicy): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the taxation policy (net/gross) configured for the current site. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [applyExternalTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#applyexternaltaxbasket)([Basket](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Basket.md)) | Applies externally set tax rates to the given [Basket](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Basket.md). |
| static [applyTax](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#applytaxbasket)([Basket](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Basket.md)) | Applies tax to the given [Basket](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Basket.md) using the platform's tax hook dispatch logic. |
| static [getCustomRateTaxClassID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#getcustomratetaxclassid)() | Returns the ID of the tax class that represents items with a custom tax rate. |
| static [getDefaultTaxClassID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#getdefaulttaxclassid)() | Returns the ID of the default tax class defined for the site. |
| static [getDefaultTaxJurisdictionID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#getdefaulttaxjurisdictionid)() | Returns the ID of the default tax jurisdiction defined for the site. |
| static [getTaxExemptTaxClassID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#gettaxexempttaxclassid)() | Returns the ID of the tax class that represents tax exempt items. |
| static [getTaxJurisdictionID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#gettaxjurisdictionidshippinglocation)([ShippingLocation](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingLocation.md)) | Returns the ID of the tax jurisdiction for the specified address. |
| static [getTaxRate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#gettaxratestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the tax rate defined for the specified combination of tax class and tax jurisdiction. |
| static [getTaxationPolicy](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#gettaxationpolicy)() | Returns the taxation policy (net/gross) configured for the current site. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### TAX_POLICY_GROSS
- TAX_POLICY_GROSS: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0
- : Constant representing the gross taxation policy.
---
### TAX_POLICY_NET
- TAX_POLICY_NET: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : Constant representing the net taxation policy.
---
## Property Details
### customRateTaxClassID
- customRateTaxClassID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the tax class that represents items with a custom tax rate. The standard order calculation
process assumes that such line items are initialized with a tax rate and a being ignored during the tax rate
lookup sequence of the calculation process.
Note that this tax class does not appear in the Business Manager tax module.
---
### defaultTaxClassID
- defaultTaxClassID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the default tax class defined for the site. This class might be used in case a product or
service does not define a tax class.
If no default tax class is defined, the method returns null.
---
### defaultTaxJurisdictionID
- defaultTaxJurisdictionID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the default tax jurisdiction defined for the site. This jurisdiction might be used in case no
jurisdiction is defined for a specific address.
If no default tax jurisdiction is defined, this method returns null.
---
### taxExemptTaxClassID
- taxExemptTaxClassID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the ID of the tax class that represents tax exempt items. The tax manager will return a tax rate of 0.0
for this tax class.
Note that this tax class does not appear in the Business Manager tax module.
---
### taxationPolicy
- taxationPolicy: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the taxation policy (net/gross) configured for the current site.
**See Also:**
- [TAX_POLICY_GROSS](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#tax_policy_gross)
- [TAX_POLICY_NET](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#tax_policy_net)
---
## Method Details
### applyExternalTax(Basket)
- static applyExternalTax(basket: [Basket](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Basket.md)): void
- : Applies externally set tax rates to the given [Basket](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Basket.md). Only use when
[LineItemCtnr.isExternallyTaxed()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.LineItemCtnr.md#isexternallytaxed) returns true. Note: a basket can only be created in EXTERNAL
tax mode using SCAPI.
Typical usage in tax calculation:
```
var TaxMgr = require('dw/order/TaxMgr');
calculateTaxes: function () {
Basket basket = BasketMgr.getCurrentBasket();
if ( basket.isExternallyTaxed() )
{
TaxMgr.applyExternalTaxation( basket );
}
else
{
// calculation with tax tables or customization
}
}
```
**Parameters:**
- basket - apply external taxation to this basket
---
### applyTax(Basket)
- static applyTax(basket: [Basket](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Basket.md)): void
- : Applies tax to the given [Basket](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.Basket.md) using the platform's tax hook dispatch logic.
This method is intended for use in custom `dw.order.calculate` hook implementations (e.g., in SFRA or
SiteGenesis) that override the default basket calculation. Calling this method instead of directly invoking
`dw.order.calculateTax` ensures that Commerce App tax providers registered via
`sfcc.app.tax.calculate` are invoked when available, with automatic fallback to the legacy
`dw.order.calculateTax` hook or the platform default tax calculation.
**WARNING:** Do NOT call this method from within a `dw.order.calculateTax` hook
implementation, as this will cause infinite recursion. This method is designed to be called from
`dw.order.calculate` hooks only.
The dispatch precedence is:
1. `sfcc.app.tax.calculate`— if a Commerce App tax provider is installed and the feature is enabled.
2. `dw.order.calculateTax`— if registered by the storefront.
3. Platform default tax calculation — using the site's tax tables.
**Typical usage in a custom `dw.order.calculate` hook:**
```
var TaxMgr = require('dw/order/TaxMgr');
exports.calculate = function (basket) {
// ... product prices, promotions, shipping ...
TaxMgr.applyTax(basket);
basket.updateTotals();
};
```
**Parameters:**
- basket - the basket for which tax should be calculated.
---
### getCustomRateTaxClassID()
- static getCustomRateTaxClassID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the tax class that represents items with a custom tax rate. The standard order calculation
process assumes that such line items are initialized with a tax rate and a being ignored during the tax rate
lookup sequence of the calculation process.
Note that this tax class does not appear in the Business Manager tax module.
---
### getDefaultTaxClassID()
- static getDefaultTaxClassID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the default tax class defined for the site. This class might be used in case a product or
service does not define a tax class.
If no default tax class is defined, the method returns null.
**Returns:**
- the ID of the default tax class defined for the site or null.
---
### getDefaultTaxJurisdictionID()
- static getDefaultTaxJurisdictionID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the default tax jurisdiction defined for the site. This jurisdiction might be used in case no
jurisdiction is defined for a specific address.
If no default tax jurisdiction is defined, this method returns null.
**Returns:**
- the ID of the default tax jurisdiction defined for the site or null.
---
### getTaxExemptTaxClassID()
- static getTaxExemptTaxClassID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the tax class that represents tax exempt items. The tax manager will return a tax rate of 0.0
for this tax class.
Note that this tax class does not appear in the Business Manager tax module.
---
### getTaxJurisdictionID(ShippingLocation)
- static getTaxJurisdictionID(location: [ShippingLocation](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingLocation.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the ID of the tax jurisdiction for the specified address. If no tax jurisdiction defined for the site
matches the specified address, this method returns null.
**Parameters:**
- location - The shipping location
**Returns:**
- the ID of the tax jurisdiction for the specified address or null.
---
### getTaxRate(String, String)
- static getTaxRate(taxClassID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), taxJurisdictionID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the tax rate defined for the specified combination of tax class and tax jurisdiction.
Method returns null if no tax rate is defined.
Method returns 0.0 of 'nontaxable' tax rate is specified (see method 'getNontaxableTaxClassID'.
**Parameters:**
- taxClassID - ID of the tax class
- taxJurisdictionID - ID of tax jusrisdiction
**Returns:**
- the tax rate defined for the specified combination of tax class and tax jurisdiction.
---
### getTaxationPolicy()
- static getTaxationPolicy(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the taxation policy (net/gross) configured for the current site.
**Returns:**
- Taxation policy configured for current site
**See Also:**
- [TAX_POLICY_GROSS](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#tax_policy_gross)
- [TAX_POLICY_NET](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TaxMgr.md#tax_policy_net)
---
# Class Template
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.util.Template](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md)
Reads an ISML template from the file system and renders it into a
[MimeEncodedText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.MimeEncodedText.md) object. Optional substitution values can be
passed to the isml template via the [render(Map)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#rendermap)
method. Substitution parameters can be accessed within the template through
```
```
or for backward compatibility through
```
```
The access through pdict only gives access to the parameter map provided at
rendering time and doesn't offer access to the system PipelineDictionary. The
pdict access to the property map is only considered to ease the transition
from SendMail pipelet API based templates. If the PipelineDictionary or
properties of the PipelineDictionary are needed, they need to be included in
the Property map passed to the render method.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Template](#templatestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a new template. |
| [Template](#templatestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a new template with the locale being set to the given localeID. |
## Method Summary
| Method | Description |
| --- | --- |
| [render](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#render)() | Renders the template specified at instantiation time, without any substitution parameters. |
| [render](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#rendermap)([Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md)) | Renders the template specified at instantiation time with the given substitution parameters. |
| [setLocale](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#setlocalestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets an optional localeID which is used instead of the current requests localeID. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### Template(String)
- Template(templateName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Creates a new template. Doesn't render the template until
[render()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#render) or [render(Map)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#rendermap)
is invoked. The current request localeID will be used for Rendering.
**Parameters:**
- templateName - file system path to the ISML template
---
### Template(String, String)
- Template(templateName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localeID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Creates a new template with the locale being set to the given localeID.
Rendering doesn't happen until [render()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#render) or
[render(Map)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#rendermap) is invoked.
**Parameters:**
- templateName - file system path to the ISML template
- localeID - localeID to be used for Rendering
---
## Method Details
### render()
- render(): [MimeEncodedText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.MimeEncodedText.md)
- : Renders the template specified at instantiation time, without any
substitution parameters. Any isprint tags referring to param/pdict will
be unresolved and will be replaced with empty strings. If there's an
explicit localeID set through [setLocale(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#setlocalestring),
it takes precedence over the localeID associated with the current
request.
**Returns:**
- MimeEncodedText with isprint tags referring to param/pdict
replaced with an empty String
---
### render(Map)
- render(params: [Map](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md)): [MimeEncodedText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.MimeEncodedText.md)
- : Renders the template specified at instantiation time with the given
substitution parameters. These parameters are available to ISML templates
through variables named 'param' and 'pdict'. Note that in this context,
pdict is not referring to the system PipelineDictionary, as the System
Pipeline Dictionary is not accessible from this script API. If there's an
explicit localeID set through [setLocale(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md#setlocalestring),
it takes precedence over the localeID associated with the current
request.
**Parameters:**
- params - Map of substitution parameters which are specified within the ISML template. Access is available from within the ISML template through named variables param or pdict.
**Returns:**
- MimeEncodedText containing the rendered template. Variables in
the template referring to param/pdict are replaced with the value
from the params map or empty if the value isn't found in the map
---
### setLocale(String)
- setLocale(localeID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Template](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Template.md)
- : Sets an optional localeID which is used instead of the current requests
localeID.
**Parameters:**
- localeID - to be used for processing this template. Throws an exception if localeID is blank
**Returns:**
- this Template object
---
# Class TotalFixedPriceDiscount
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.campaign.Discount](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md)
- [dw.campaign.TotalFixedPriceDiscount](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.TotalFixedPriceDiscount.md)
Represents a _total fix price_ discount on a group of products in the
discount plan. For example: "buy 3 products of type X for a total price
of $29.99".
## Property Summary
| Property | Description |
| --- | --- |
| [totalFixedPrice](#totalfixedprice): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the total fixed price amount. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getTotalFixedPrice](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.TotalFixedPriceDiscount.md#gettotalfixedprice)() | Returns the total fixed price amount. |
### Methods inherited from class Discount
[getItemPromotionTiers](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getitempromotiontiers), [getPromotion](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getpromotion), [getPromotionTier](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getpromotiontier), [getQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getquantity), [getType](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#gettype)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### totalFixedPrice
- totalFixedPrice: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the total fixed price amount.
---
## Method Details
### getTotalFixedPrice()
- getTotalFixedPrice(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the total fixed price amount.
**Returns:**
- Total fixed price amount
---
# Class TrackingInfo
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.Extensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.Extensible.md)
- [dw.order.TrackingInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md)
Provides basic information about a tracking info. An instance is identified by an ID and can be referenced from n ShippingOrderItems
using [TrackingRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingRef.md)s. This also allows one [ShippingOrderItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrderItem.md) to be associated with n TrackingInfo.
**See Also:**
- [ShippingOrder.addTrackingInfo(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrder.md#addtrackinginfostring)
- [ShippingOrderItem.addTrackingRef(String, Quantity)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrderItem.md#addtrackingrefstring-quantity)
## Property Summary
| Property | Description |
| --- | --- |
| [ID](#id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Get the mandatory identifier for this tracking information. |
| [carrier](#carrier): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Get the Carrier. |
| [carrierService](#carrierservice): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Get the service(ship method) of the used carrier. |
| [shipDate](#shipdate): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) | Get the ship date. |
| [shippingOrder](#shippingorder): [ShippingOrder](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrder.md) `(read-only)` | Gets the shipping order. |
| [trackingNumber](#trackingnumber): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Get the tracking number. |
| [trackingRefs](#trackingrefs): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Gets the tracking refs (shipping order items) which are assigned to this tracking info. |
| [warehouseID](#warehouseid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Get the id of the shipping warehouse. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getCarrier](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#getcarrier)() | Get the Carrier. |
| [getCarrierService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#getcarrierservice)() | Get the service(ship method) of the used carrier. |
| [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#getid)() | Get the mandatory identifier for this tracking information. |
| [getShipDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#getshipdate)() | Get the ship date. |
| [getShippingOrder](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#getshippingorder)() | Gets the shipping order. |
| [getTrackingNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#gettrackingnumber)() | Get the tracking number. |
| [getTrackingRefs](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#gettrackingrefs)() | Gets the tracking refs (shipping order items) which are assigned to this tracking info. |
| [getWarehouseID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#getwarehouseid)() | Get the id of the shipping warehouse. |
| [setCarrier](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#setcarrierstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Set the Carrier. |
| [setCarrierService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#setcarrierservicestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Set the service(ship method) of the used carrier. |
| [setShipDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#setshipdatedate)([Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)) | Set the ship date. |
| [setTrackingNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#settrackingnumberstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Set the TrackingNumber. |
| [setWarehouseID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md#setwarehouseidstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Set the id of the shipping warehouse. |
### Methods inherited from class Extensible
[describe](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.Extensible.md#describe), [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.Extensible.md#getcustom)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### ID
- ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Get the mandatory identifier for this tracking information. The id allows the tracking information to be referenced from
[TrackingRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingRef.md)s. To support short shipping a shipping-order-item can manage a list of
TrackingRefs, each with an optional quantity value allowing individual items to ship in multiple
parcels with known item quantity in each.
**See Also:**
- [ShippingOrder.addTrackingInfo(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrder.md#addtrackinginfostring)
---
### carrier
- carrier: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the Carrier.
---
### carrierService
- carrierService: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the service(ship method) of the used carrier.
---
### shipDate
- shipDate: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Get the ship date.
---
### shippingOrder
- shippingOrder: [ShippingOrder](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrder.md) `(read-only)`
- : Gets the shipping order.
---
### trackingNumber
- trackingNumber: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the tracking number.
---
### trackingRefs
- trackingRefs: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Gets the tracking refs (shipping order items) which are assigned to this tracking info.
---
### warehouseID
- warehouseID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the id of the shipping warehouse.
---
## Method Details
### getCarrier()
- getCarrier(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the Carrier.
**Returns:**
- the Carrier
---
### getCarrierService()
- getCarrierService(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the service(ship method) of the used carrier.
**Returns:**
- the carrier service (ship method)
---
### getID()
- getID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the mandatory identifier for this tracking information. The id allows the tracking information to be referenced from
[TrackingRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingRef.md)s. To support short shipping a shipping-order-item can manage a list of
TrackingRefs, each with an optional quantity value allowing individual items to ship in multiple
parcels with known item quantity in each.
**Returns:**
- the id
**See Also:**
- [ShippingOrder.addTrackingInfo(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrder.md#addtrackinginfostring)
---
### getShipDate()
- getShipDate(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Get the ship date.
**Returns:**
- the ship date
---
### getShippingOrder()
- getShippingOrder(): [ShippingOrder](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrder.md)
- : Gets the shipping order.
**Returns:**
- the shipping order
---
### getTrackingNumber()
- getTrackingNumber(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the tracking number.
**Returns:**
- the TrackingNumber
---
### getTrackingRefs()
- getTrackingRefs(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Gets the tracking refs (shipping order items) which are assigned to this tracking info.
**Returns:**
- the tracking refs (shipping order items) which are assigned to this tracking info.
---
### getWarehouseID()
- getWarehouseID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the id of the shipping warehouse.
**Returns:**
- the id of the shipping warehouse
---
### setCarrier(String)
- setCarrier(carrier: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Set the Carrier.
**Parameters:**
- carrier - the Carrier
---
### setCarrierService(String)
- setCarrierService(carrierService: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Set the service(ship method) of the used carrier.
**Parameters:**
- carrierService - the carrier service, eg. the ship method
---
### setShipDate(Date)
- setShipDate(shipDate: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)): void
- : Set the ship date.
**Parameters:**
- shipDate - the ship date
---
### setTrackingNumber(String)
- setTrackingNumber(trackingNumber: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Set the TrackingNumber.
**Parameters:**
- trackingNumber - the TrackingNumber
---
### setWarehouseID(String)
- setWarehouseID(warehouseID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Set the id of the shipping warehouse.
**Parameters:**
- warehouseID - the id of the shipping warehouse
---
# Class TrackingRef
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.order.TrackingRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingRef.md)
Provides basic information about the [TrackingInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md) a
[ShippingOrderItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrderItem.md) is contained.
## Property Summary
| Property | Description |
| --- | --- |
| [quantity](#quantity): [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md) | Gets the quantity, the shipping order item is assigned to the tracking info. |
| [shippingOrderItem](#shippingorderitem): [ShippingOrderItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrderItem.md) `(read-only)` | Gets the shipping order item which is assigned to the tracking info. |
| [trackingInfo](#trackinginfo): [TrackingInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md) `(read-only)` | Gets the tracking info, the shipping order item is assigned to. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingRef.md#getquantity)() | Gets the quantity, the shipping order item is assigned to the tracking info. |
| [getShippingOrderItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingRef.md#getshippingorderitem)() | Gets the shipping order item which is assigned to the tracking info. |
| [getTrackingInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingRef.md#gettrackinginfo)() | Gets the tracking info, the shipping order item is assigned to. |
| [setQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingRef.md#setquantityquantity)([Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md)) | Sets the quantity, the shipping order item is assigned to the tracking info. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### quantity
- quantity: [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md)
- : Gets the quantity, the shipping order item is assigned to the tracking
info.
---
### shippingOrderItem
- shippingOrderItem: [ShippingOrderItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrderItem.md) `(read-only)`
- : Gets the shipping order item which is assigned to the tracking info.
---
### trackingInfo
- trackingInfo: [TrackingInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md) `(read-only)`
- : Gets the tracking info, the shipping order item is assigned to.
---
## Method Details
### getQuantity()
- getQuantity(): [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md)
- : Gets the quantity, the shipping order item is assigned to the tracking
info.
**Returns:**
- the quantity the shipping order item is assigned to the tracking
info.
---
### getShippingOrderItem()
- getShippingOrderItem(): [ShippingOrderItem](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.ShippingOrderItem.md)
- : Gets the shipping order item which is assigned to the tracking info.
**Returns:**
- the shipping order item
---
### getTrackingInfo()
- getTrackingInfo(): [TrackingInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.TrackingInfo.md)
- : Gets the tracking info, the shipping order item is assigned to.
**Returns:**
- the tracking info
---
### setQuantity(Quantity)
- setQuantity(quantity: [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md)): void
- : Sets the quantity, the shipping order item is assigned to the tracking
info.
**Parameters:**
- quantity - the quantity, the shipping order item is assigned to the tracking info.
---
# Class Transaction
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.system.Transaction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md)
Represents the current transaction. A transaction provides a context for performing atomic changes to persistent
business objects. Before a business object can be created, changed, or deleted, a transaction must be started using
the [begin()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md#begin) method. All changes on the touched business objects will only be made durable when the
transaction is committed with [commit()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md#commit). If a transaction is rolled back, all changes so far will be reverted
and the business object will have their previous state again. It is possible to begin a transaction multiple times in
a nested way (like begin-begin-commit-commit). In this case, in order to commit the changes the commit method must be
called symmetrically as often as begin. It is also possible to run multiple transactions within a single request, one
after another (like begin-commit-begin-commit). In case of any exception while working with business objects inside
of a transaction, the transaction cannot be committed anymore, but only be rolled back. Business code may try to take
appropriate actions if it expects business-related problems at commit (for example, constraint violations). When a
transaction is still open at the end of a pipeline call, controller call, or job step, the remaining changes are
committed unless an exception is thrown.
The following best practices exist for using transactions:
- Avoid long running transactions in jobs.
- Use one transaction for changes that belong together and need a joint rollback. In most cases, one transaction for all changes in a request is better than multiple transactions for each individual object.
- Don’t begin and commit a huge number of small transactions in a loop.
- Avoid changing the same objects in parallel transactions.
Example 1 - explicit control:
```
var txn = require('dw/system/Transaction');
txn.begin();
// work with business objects here
txn.commit();
```
Example 2 - implicit control:
```
var txn = require('dw/system/Transaction');
txn.wrap(function(){
// work with business objects here
});
```
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [begin](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md#begin)() | Begins a transaction. |
| static [commit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md#commit)() | Commits the current transaction. |
| static [rollback](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md#rollback)() | Rolls back the current transaction. |
| static [wrap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md#wrapfunction)([Function](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md)) | Encloses the provided callback function in a begin-commit transactional context. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Method Details
### begin()
- static begin(): void
- : Begins a transaction.
---
### commit()
- static commit(): void
- : Commits the current transaction. The transaction must have been started with [begin()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md#begin) before.
---
### rollback()
- static rollback(): void
- : Rolls back the current transaction. The transaction must have been started with [begin()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.system.Transaction.md#begin) before.
---
### wrap(Function)
- static wrap(callback: [Function](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Encloses the provided callback function in a begin-commit transactional context. If the transaction cannot be
committed successfully, it is rolled back instead and an exception is thrown.
**Parameters:**
- callback - a function that should be executed within a transactional context
**Returns:**
- the result of the callback function, if it returns something
---
# Class TypeError
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Error](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md)
- [TopLevel.TypeError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.TypeError.md)
Represents a type error.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [TypeError](#typeerror)() | Constructs the error. |
| [TypeError](#typeerrorstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs the error with the specified message. |
## Method Summary
### Methods inherited from class Error
[captureStackTrace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#capturestacktraceerror-function), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#tostring)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### TypeError()
- TypeError()
- : Constructs the error.
---
### TypeError(String)
- TypeError(msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs the error with the
specified message.
**Parameters:**
- msg - the type error message.
---
# Class Uint16Array
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Uint16Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint16Array.md)
An optimized array to store 16-bit unsigned integer numbers. Elements of this array are stored in an
[ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) object.
**API Version:**
**note:** Available from version 21.2.
## Constant Summary
| Constant | Description |
| --- | --- |
| [BYTES_PER_ELEMENT](#bytes_per_element): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2 | The number value of the element size. |
## Property Summary
| Property | Description |
| --- | --- |
| [buffer](#buffer): [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) | The array buffer referenced by this typed array. |
| [byteLength](#bytelength): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The number of bytes in the array buffer used by this typed array. |
| [byteOffset](#byteoffset): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The start offset for this typed array within the array buffer. |
| [length](#length): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The number of elements. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Uint16Array](#uint16array)() | Creates an empty array. |
| [Uint16Array](#uint16arraynumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates an array with the given element count. |
| [Uint16Array](#uint16arrayobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Creates an array as a copy of the passed typed array. |
| [Uint16Array](#uint16arrayarray)([Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md)) | Creates an array as a copy of the passed array. |
| [Uint16Array](#uint16arrayarraybuffer-number-number)([ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates a typed array as a view on the given [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md). |
## Method Summary
| Method | Description |
| --- | --- |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint16Array.md#getnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the value at the specified index. |
| [set](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint16Array.md#setobject-number)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Copies all values from the source array into this typed array. |
| [subarray](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint16Array.md#subarraynumber-number)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a new array object based on the same [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) store. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### BYTES_PER_ELEMENT
- BYTES_PER_ELEMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2
- : The number value of the element size.
---
## Property Details
### buffer
- buffer: [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md)
- : The array buffer referenced by this typed array.
---
### byteLength
- byteLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The number of bytes in the array buffer used by this typed array.
---
### byteOffset
- byteOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The start offset for this typed array within the array buffer.
---
### length
- length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The number of elements.
---
## Constructor Details
### Uint16Array()
- Uint16Array()
- : Creates an empty array.
---
### Uint16Array(Number)
- Uint16Array(length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates an array with the given element count.
**Parameters:**
- length - The number of elements.
---
### Uint16Array(Object)
- Uint16Array(typedArray: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Creates an array as a copy of the passed typed array.
**Parameters:**
- typedArray - The source typed array.
---
### Uint16Array(Array)
- Uint16Array(array: [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md))
- : Creates an array as a copy of the passed array.
**Parameters:**
- array - The source array.
---
### Uint16Array(ArrayBuffer, Number, Number)
- Uint16Array(buffer: [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md), byteOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates a typed array as a view on the given [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md).
**Parameters:**
- buffer - The array buffer storage object.
- byteOffset - Optional. The offset within the array buffer in bytes.
- length - Optional. The number of elements for the target typed array. The passed array buffer must be large enough to store the number of elements specified.
---
## Method Details
### get(Number)
- get(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the value at the specified index.
Note: This is not ECMAScript standard. Use array element access syntax for single value access.
**Parameters:**
- index - The index to use.
**Returns:**
- The value at the specified index.
---
### set(Object, Number)
- set(values: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), offset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void
- : Copies all values from the source array into this typed array.
**Parameters:**
- values - The source values. Can be an array or a typed array.
- offset - Optional. Target offset.
---
### subarray(Number, Number)
- subarray(begin: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), end: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Uint16Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint16Array.md)
- : Returns a new array object based on the same [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) store.
**Parameters:**
- begin - Optional. The first included element.
- end - Optional. The index of the end. This element is not included.
**Returns:**
- The new array object.
---
# Class Uint32Array
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Uint32Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint32Array.md)
An optimized array to store 32-bit unsigned integer numbers. Elements of this array are stored in an
[ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) object.
**API Version:**
**note:** Available from version 21.2.
## Constant Summary
| Constant | Description |
| --- | --- |
| [BYTES_PER_ELEMENT](#bytes_per_element): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 4 | Number value of the element size. |
## Property Summary
| Property | Description |
| --- | --- |
| [buffer](#buffer): [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) | The array buffer referenced by this typed array. |
| [byteLength](#bytelength): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The number of bytes in the array buffer used by this typed array. |
| [byteOffset](#byteoffset): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The start offset for this typed array within the array buffer. |
| [length](#length): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The number of elements. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Uint32Array](#uint32array)() | Creates an empty array. |
| [Uint32Array](#uint32arraynumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates an array with the given element count. |
| [Uint32Array](#uint32arrayobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Creates an array as a copy of the passed typed array. |
| [Uint32Array](#uint32arrayarray)([Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md)) | Creates an array as a copy of the passed array. |
| [Uint32Array](#uint32arrayarraybuffer-number-number)([ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates a typed array as a view on the given [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md). |
## Method Summary
| Method | Description |
| --- | --- |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint32Array.md#getnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the value at the specified index. |
| [set](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint32Array.md#setobject-number)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Copies all values from the source array into this typed array. |
| [subarray](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint32Array.md#subarraynumber-number)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a new array object based on the same [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) store. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### BYTES_PER_ELEMENT
- BYTES_PER_ELEMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 4
- : Number value of the element size.
---
## Property Details
### buffer
- buffer: [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md)
- : The array buffer referenced by this typed array.
---
### byteLength
- byteLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The number of bytes in the array buffer used by this typed array.
---
### byteOffset
- byteOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The start offset for this typed array within the array buffer.
---
### length
- length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The number of elements.
---
## Constructor Details
### Uint32Array()
- Uint32Array()
- : Creates an empty array.
---
### Uint32Array(Number)
- Uint32Array(length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates an array with the given element count.
**Parameters:**
- length - The number of elements.
---
### Uint32Array(Object)
- Uint32Array(typedArray: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Creates an array as a copy of the passed typed array.
**Parameters:**
- typedArray - The source typed array.
---
### Uint32Array(Array)
- Uint32Array(array: [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md))
- : Creates an array as a copy of the passed array.
**Parameters:**
- array - The source array.
---
### Uint32Array(ArrayBuffer, Number, Number)
- Uint32Array(buffer: [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md), byteOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates a typed array as a view on the given [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md).
**Parameters:**
- buffer - The array buffer storage object.
- byteOffset - Optional. The offset within the array buffer in bytes.
- length - Optional. The number of elements for the target typed array. The passed array buffer must be large enough to store the number of elements specified.
---
## Method Details
### get(Number)
- get(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the value at the specified index.
Note: This is not ECMAScript standard. Use array element access syntax for single value access.
**Parameters:**
- index - The index to use.
**Returns:**
- The value at the specified index.
---
### set(Object, Number)
- set(values: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), offset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void
- : Copies all values from the source array into this typed array.
**Parameters:**
- values - The source values. Can be an array or a typed array.
- offset - Optional. Target offset.
---
### subarray(Number, Number)
- subarray(begin: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), end: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Uint32Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint32Array.md)
- : Returns a new array object based on the same [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) store.
**Parameters:**
- begin - Optional. The first included element.
- end - Optional. The index of the end. This element is not included.
**Returns:**
- The new array object.
---
# Class Uint8Array
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Uint8Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8Array.md)
An optimized array to store 8-bit unsigned integer numbers. Elements of this array are stored in an
[ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) object.
**API Version:**
**note:** Available from version 21.2.
## Constant Summary
| Constant | Description |
| --- | --- |
| [BYTES_PER_ELEMENT](#bytes_per_element): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | Number value of the element size. |
## Property Summary
| Property | Description |
| --- | --- |
| [buffer](#buffer): [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) | The array buffer referenced by this typed array. |
| [byteLength](#bytelength): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The number of bytes in the array buffer used by this typed array. |
| [byteOffset](#byteoffset): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The start offset for this typed array within the array buffer. |
| [length](#length): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The number of elements. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Uint8Array](#uint8array)() | Creates an empty array. |
| [Uint8Array](#uint8arraynumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates an array with the given element count. |
| [Uint8Array](#uint8arrayobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Creates an array as a copy of the passed typed array. |
| [Uint8Array](#uint8arrayarray)([Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md)) | Creates an array as a copy of the passed array. |
| [Uint8Array](#uint8arrayarraybuffer-number-number)([ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates a typed array as a view on the given [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md). |
## Method Summary
| Method | Description |
| --- | --- |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8Array.md#getnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the value at the specified index. |
| [set](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8Array.md#setobject-number)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Copies all values from the source array into this typed array. |
| [subarray](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8Array.md#subarraynumber-number)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a new array object based on the same [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) store. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### BYTES_PER_ELEMENT
- BYTES_PER_ELEMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : Number value of the element size.
---
## Property Details
### buffer
- buffer: [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md)
- : The array buffer referenced by this typed array.
---
### byteLength
- byteLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The number of bytes in the array buffer used by this typed array.
---
### byteOffset
- byteOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The start offset for this typed array within the array buffer.
---
### length
- length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The number of elements.
---
## Constructor Details
### Uint8Array()
- Uint8Array()
- : Creates an empty array.
---
### Uint8Array(Number)
- Uint8Array(length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates an array with the given element count.
**Parameters:**
- length - The number of elements.
---
### Uint8Array(Object)
- Uint8Array(typedArray: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Creates an array as a copy of the passed typed array.
**Parameters:**
- typedArray - The source typed array.
---
### Uint8Array(Array)
- Uint8Array(array: [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md))
- : Creates an array as a copy of the passed array.
**Parameters:**
- array - The source array.
---
### Uint8Array(ArrayBuffer, Number, Number)
- Uint8Array(buffer: [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md), byteOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates a typed array as a view on the given [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md).
**Parameters:**
- buffer - The array buffer storage object.
- byteOffset - Optional. The offset within the array buffer in bytes.
- length - Optional. The number of elements for the target typed array. The passed array buffer must be large enough to store the number of elements specified.
---
## Method Details
### get(Number)
- get(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the value at the specified index.
Note: This is not ECMAScript standard. Use array element access syntax for single value access.
**Parameters:**
- index - The index to use.
**Returns:**
- The value at the specified index.
---
### set(Object, Number)
- set(values: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), offset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void
- : Copies all values from the source array into this typed array.
**Parameters:**
- values - The source values. Can be an array or a typed array.
- offset - Optional. Target offset.
---
### subarray(Number, Number)
- subarray(begin: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), end: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Uint8Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8Array.md)
- : Returns a new array object based on the same [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) store.
**Parameters:**
- begin - Optional. The first included element.
- end - Optional. The index of the end. This element is not included.
**Returns:**
- The new array object.
---
# Class Uint8ClampedArray
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Uint8ClampedArray](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8ClampedArray.md)
An optimized array to store 8-bit unsigned integer numbers. If a value outside of the range 0-255 is attempted to be
set, either 0 or 255 is set instead. Elements of this array are stored in an [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) object.
**API Version:**
**note:** Available from version 21.2.
## Constant Summary
| Constant | Description |
| --- | --- |
| [BYTES_PER_ELEMENT](#bytes_per_element): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | Number value of the element size. |
## Property Summary
| Property | Description |
| --- | --- |
| [buffer](#buffer): [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) | The array buffer referenced by this typed array. |
| [byteLength](#bytelength): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The number of bytes in the array buffer used by this typed array. |
| [byteOffset](#byteoffset): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The start offset for this typed array within the array buffer. |
| [length](#length): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The number of elements. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Uint8ClampedArray](#uint8clampedarray)() | Creates an empty array. |
| [Uint8ClampedArray](#uint8clampedarraynumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates an array with the given element count. |
| [Uint8ClampedArray](#uint8clampedarrayobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Creates an array as a copy of the passed typed array. |
| [Uint8ClampedArray](#uint8clampedarrayarray)([Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md)) | Creates an array as a copy of the passed array. |
| [Uint8ClampedArray](#uint8clampedarrayarraybuffer-number-number)([ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Creates a typed array as a view on the given [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md). |
## Method Summary
| Method | Description |
| --- | --- |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8ClampedArray.md#getnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the value at the specified index. |
| [set](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8ClampedArray.md#setobject-number)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Copies all values from the source array into this typed array. |
| [subarray](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8ClampedArray.md#subarraynumber-number)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns a new array object based on the same [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) store. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### BYTES_PER_ELEMENT
- BYTES_PER_ELEMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : Number value of the element size.
---
## Property Details
### buffer
- buffer: [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md)
- : The array buffer referenced by this typed array.
---
### byteLength
- byteLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The number of bytes in the array buffer used by this typed array.
---
### byteOffset
- byteOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The start offset for this typed array within the array buffer.
---
### length
- length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The number of elements.
---
## Constructor Details
### Uint8ClampedArray()
- Uint8ClampedArray()
- : Creates an empty array.
---
### Uint8ClampedArray(Number)
- Uint8ClampedArray(length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates an array with the given element count.
**Parameters:**
- length - The number of elements.
---
### Uint8ClampedArray(Object)
- Uint8ClampedArray(typedArray: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Creates an array as a copy of the passed typed array.
**Parameters:**
- typedArray - The source typed array.
---
### Uint8ClampedArray(Array)
- Uint8ClampedArray(array: [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md))
- : Creates an array as a copy of the passed array.
**Parameters:**
- array - The source array.
---
### Uint8ClampedArray(ArrayBuffer, Number, Number)
- Uint8ClampedArray(buffer: [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md), byteOffset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), length: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
- : Creates a typed array as a view on the given [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md).
**Parameters:**
- buffer - The array buffer storage object.
- byteOffset - Optional. The offset within the array buffer in bytes.
- length - Optional. The number of elements for the target typed array. The passed array buffer must be large enough to store the number of elements specified.
---
## Method Details
### get(Number)
- get(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the value at the specified index.
Note: This is not ECMAScript standard. Use array element access syntax for single value access.
**Parameters:**
- index - The index to use.
**Returns:**
- The value at the specified index.
---
### set(Object, Number)
- set(values: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), offset: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void
- : Copies all values from the source array into this typed array.
**Parameters:**
- values - The source values. Can be an array or a typed array.
- offset - Optional. Target offset.
---
### subarray(Number, Number)
- subarray(begin: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), end: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Uint8ClampedArray](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Uint8ClampedArray.md)
- : Returns a new array object based on the same [ArrayBuffer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.ArrayBuffer.md) store.
**Parameters:**
- begin - Optional. The first included element.
- end - Optional. The index of the end. This element is not included.
**Returns:**
- The new array object.
---
# Class URIError
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Error](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md)
- [TopLevel.URIError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.URIError.md)
Represents a URI error.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [URIError](#urierror)() | Constructs the error. |
| [URIError](#urierrorstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs the error with the specified message. |
## Method Summary
### Methods inherited from class Error
[captureStackTrace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#capturestacktraceerror-function), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#tostring)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### URIError()
- URIError()
- : Constructs the error.
---
### URIError(String)
- URIError(msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs the error with the
specified message.
**Parameters:**
- msg - the URI error message.
---
# Class URL
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.web.URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
Represents a URL in Commerce Cloud Digital.
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [abs](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#abs)() | Makes the URL absolute and ensures that the protocol of the request is used or http in a mail context. |
| [append](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#appendstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Append a request parameter to this URL. |
| [appendCSRFTokenBM](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#appendcsrftokenbm)() | Appends, if applicable, a CSRF protection token to this URL. |
| [host](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#hoststring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Updates the URL with the specified host name Note: This method is not applicable for static content or image transformation URLs. |
| [http](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#http)() | Makes the URL absolute and ensures that the protocol http is used. |
| [https](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#https)() | Makes the URL absolute and ensures that the protocol https is used. |
| [relative](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#relative)() | Makes the URL relative. |
| [remove](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#removestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Remove a request parameter from this URL. |
| [siteHost](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#sitehost)() | Updates the URL with the site host name Note: This method is not applicable for static content or image transformation URLs. |
| [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md#tostring)() | Return String representation of the URL. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Method Details
### abs()
- abs(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Makes the URL absolute and ensures that the protocol of the request is used
or http in a mail context.
Note: This method is not applicable for static content or image transformation
URLs. In this case a runtime exception is thrown.
**Returns:**
- A new URL instance.
---
### append(String, String)
- append(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Append a request parameter to this URL.
**Parameters:**
- name - The parameter name. Must not be null.
- value - The parameter value. If null, then treated as empty value.
**Returns:**
- A reference to this URL.
---
### appendCSRFTokenBM()
- appendCSRFTokenBM(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- :
Appends, if applicable, a CSRF protection token to this URL. The CSRF token will only be appended under the following conditions:
- the URL is a pipeline URL
- the URL is for Business Manager
If a CSRF token already exists in the URL, it will be replaced with a newly generated one.
**Returns:**
- a reference to this URL, with a CSRF token appended if applicable.
---
### host(String)
- host(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Updates the URL with the specified host name
Note: This method is not applicable for static content or image transformation
URLs. In this case a runtime exception is thrown.
**Parameters:**
- host - The host name that is used to update the URL.
**Returns:**
- A new URL instance.
---
### http()
- http(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Makes the URL absolute and ensures that the protocol http is used.
Note: This method is not applicable for static content or image transformation
URLs. In this case a runtime exception is thrown.
**Returns:**
- A new URL instance.
---
### https()
- https(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Makes the URL absolute and ensures that the protocol https is used.
Note: This method is not applicable for static content or image transformation
URLs. In this case a runtime exception is thrown.
**Returns:**
- A new URL instance.
---
### relative()
- relative(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Makes the URL relative.
Note: This method is not applicable for static content or image transformation
URLs. In this case a runtime exception is thrown.
**Returns:**
- A new URL instance.
---
### remove(String)
- remove(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Remove a request parameter from this URL. If the parameter is not part
of the URL, nothing is done.
**Parameters:**
- name - The parameter name. Must not be null.
**Returns:**
- A reference to this URL.
---
### siteHost()
- siteHost(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Updates the URL with the site host name
Note: This method is not applicable for static content or image transformation
URLs. In this case a runtime exception is thrown.
**Returns:**
- A new URL instance.
---
### toString()
- toString(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Return String representation of the URL.
**Returns:**
- the URL as a string.
---
# Class URLAction
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.web.URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md)
The class is needed for the URL creation within template processing. It
represents a reference to a pipeline name and start node, usually used in a
HREF or a FORM action. URLAction instances are usually passed to one of the
methods in [URLUtils](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md) in order to generate an appropriately
constructed Commerce Cloud Digital URL. For example:
`
var urlAction : URLAction = new URLAction("SimplePipeline-Start", "SampleSite");
var url : URL = URLUtils.abs(false, urlAction1);
// url.toString() equals "http://" + request.httpHost + "/on/demandware.store/Sites-SampleSite-Site/default/SimplePipeline-Start"
`
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [URLAction](#urlactionstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs an action for the current site and locale. |
| [URLAction](#urlactionstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs an action for the specified site and the current locale. |
| [URLAction](#urlactionstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs an action for the specified site and locale. |
| [URLAction](#urlactionstring-string-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs an URL action for the specified site, locale and hostname. |
## Method Summary
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### URLAction(String)
- URLAction(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs an action for the current site and locale.
**Parameters:**
- action - the target pipeline/controller, e.g. 'Default-Start'
---
### URLAction(String, String)
- URLAction(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), siteName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs an action for the specified site and the current locale.
**Parameters:**
- action - the target pipeline/controller, e.g. 'Default-Start'
- siteName - the target site, e.g. 'SampleSite'
---
### URLAction(String, String, String)
- URLAction(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), siteName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), locale: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs an action for the specified site and locale.
**Parameters:**
- action - the target pipeline/controller, e.g.: 'Default-Start'
- siteName - the target site, e.g. 'SampleSite'
- locale - the target locale, e.g. 'default'
---
### URLAction(String, String, String, String)
- URLAction(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), siteName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), locale: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), hostName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs an URL action for the specified site, locale and hostname.
The hostname must be defined in the site alias settings. If no hostname is provided, the HTTP/HTTPS
host defined in the site alias settings will be used. If no HTTP/HTTPS host is defined in the site alias
settings, the hostname of the current request is used.
**Parameters:**
- action - the target pipeline/controller, e.g.: 'Default-Start'
- siteName - the target site, e.g. 'SampleSite'
- locale - the target locale, e.g. 'default'
- hostName - the host name, e.g. ‘www.shop.com'
**Throws:**
- Exception - if hostName is not defined in site alias settings
---
# Class URLParameter
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.web.URLParameter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)
This class represents a key-value-pair for URL parameters.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [URLParameter](#urlparameterstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs the parameter using the specified name and value and endocded in the form "name=value". |
| [URLParameter](#urlparameterstring-string-boolean)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)) | Constructs the parameter using the specified name and value. |
## Method Summary
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### URLParameter(String, String)
- URLParameter(aName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), aValue: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Constructs the parameter using the specified name and value and endocded
in the form "name=value".
**Parameters:**
- aName - the name
- aValue - the value
---
### URLParameter(String, String, Boolean)
- URLParameter(aName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), aValue: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), encodeName: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md))
- : Constructs the parameter using the specified name and value. If the "encodeName" is set to true,
the parameter is encoded in the form "name=value". Otherwise, it only
contains the "value" (needed for URL patterns).
**Parameters:**
- aName - the name
- aValue - the value
- encodeName - if true, the name will be part of the string form
---
# Class URLRedirect
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.web.URLRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md)
Represents a URLRedirect in Commerce Cloud Digital.
## Property Summary
| Property | Description |
| --- | --- |
| [location](#location): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the URL which was calculated to be the redirect URL. |
| [status](#status): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the corresponding status code for the redirect location. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getLocation](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md#getlocation)() | Returns the URL which was calculated to be the redirect URL. |
| [getStatus](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md#getstatus)() | Returns the corresponding status code for the redirect location. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### location
- location: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the URL which was calculated to be the redirect URL.
The Location parameter can be directly used as value for an redirect location.
---
### status
- status: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the corresponding status code for the redirect location.
---
## Method Details
### getLocation()
- getLocation(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the URL which was calculated to be the redirect URL.
The Location parameter can be directly used as value for an redirect location.
**Returns:**
- redirect location
---
### getStatus()
- getStatus(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the corresponding status code for the redirect location.
**Returns:**
- status code
---
# Class URLRedirectMgr
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.web.URLRedirectMgr](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirectMgr.md)
URLRedirect manager class. Methods in this class generate URLRedirects based on the
current configuration for Static, Dynamic and URLRedirect mappings in Commerce
Cloud Digital.
Information used to calculate URLRedirects are determined from the current HTTP
request. The URL which is used to find a redirect can be accessed with [getRedirectOrigin()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirectMgr.md#getredirectorigin).
## Property Summary
| Property | Description |
| --- | --- |
| [redirect](#redirect): [URLRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md) `(read-only)` | Returns an URLRedirect object, containing a location and status. |
| [redirectOrigin](#redirectorigin): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the relative origin url (without protocol, port, hostname and site path information) which will be used in [getRedirect()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirectMgr.md#getredirect) to calculate a redirect location for. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [getRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirectMgr.md#getredirect)() | Returns an URLRedirect object, containing a location and status. |
| static [getRedirectOrigin](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirectMgr.md#getredirectorigin)() | Returns the relative origin url (without protocol, port, hostname and site path information) which will be used in [getRedirect()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirectMgr.md#getredirect) to calculate a redirect location for. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### redirect
- redirect: [URLRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md) `(read-only)`
- : Returns an URLRedirect object, containing a location and status. The redirect is calculated
based on origin url of current request and the configured Static, Dynamic and URLRedirect mappings for
the requested site.
---
### redirectOrigin
- redirectOrigin: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the relative origin url (without protocol, port, hostname and site path information)
which will be used in [getRedirect()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirectMgr.md#getredirect) to calculate a redirect location for.
---
## Method Details
### getRedirect()
- static getRedirect(): [URLRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirect.md)
- : Returns an URLRedirect object, containing a location and status. The redirect is calculated
based on origin url of current request and the configured Static, Dynamic and URLRedirect mappings for
the requested site.
**Returns:**
- URLRedirect containing the location and status code,
null in case of no redirect was found
---
### getRedirectOrigin()
- static getRedirectOrigin(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the relative origin url (without protocol, port, hostname and site path information)
which will be used in [getRedirect()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLRedirectMgr.md#getredirect) to calculate a redirect location for.
**Returns:**
- relative origin url
---
# Class URLUtils
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.web.URLUtils](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md)
URL utility class. Methods in this class generate URLs used in Commerce Cloud Digital.
Site related information in the generated URLs is determined from the current HTTP request.
Methods belong to two groups: generating absolute and relative URLs. Absolute URL methods
are further subdivided into those creating URLs with specified protocol and those
using protocol information from the request. Corresponding to the protocol, the host name
from the HTTP/HTTPS host preference is used. If preference is not set, the host name from the
current request is included in resulting absolute URL.
URLs do not include a session ID anymore. The appendSID argument therefore does not have any effect.
When creating a pipeline URL with one of the methods url(), http(), https() or abs() by default
the generated URL is a Commerce Cloud Digital URL ("/on/demandware.store/..."). If search friendly URLs are
enabled (old or new) the methods generate search friendly URLs. Search friendly URLs are only generated for
certain pipeline names. Here a list of these pipeline names:
- Product-Show with a 'pid' parameter \[productID\] - search friendly URL for a product
- Product-ShowInCategory with the 'cgid' parameter \[categoryID\] and 'pid' parameter \[productID\] - search friendly URL for a product shown in a specific category
- Search-Show with a 'cgid' parameter \[categoryID\] - search friendly URL for a category
- Search-Show with a 'pid' parameter \[productID\] - search friendly URL for a product
- Search-ShowContent with a 'fdid' parameter \[folderID\] - search friendly URL for a folder (ONLY works with new storefront URLs)
- Page-Show with a 'cid' parameter \[contentID\] - search friendly URL for a content page
Parameter `transform`:
Some methods allow the specification of image transformation parameters. Image
transformation is only performed if the Dynamic Imaging Service (DIS) is available
for the Commerce Cloud Digital instance. Otherwise a standard static content URL is returned.
The to-be-transformed image needs to be hosted on Digital.
Image transformation parameters are specified as JavaScript object literal. They
are translated into URL parameters. See [Create Image Transformation URLs.](https://help.salesforce.com/s/articleView?id=cc.b2c\_creating\_image\_transformation\_urls.htm)
| Type of transformation | Parameters | Description |
| --- |--- |--- |
| Scale an image | `scaleWidth` `scaleHeight` `scaleMode` | The `scaleWidth` and `scaleHeight` parameters are both integers; setting one of these parameters triggers a scaling operation. If both are provided, the one that scales the image less is used to calculate the scale factor. The image is then automatically cropped accord to the second dimension, with a centered position of the cropped area. If the parameter would scale the image larger, only this operation is applied, if the image remains within acceptable pixel dimensions.
Note: `scaleMode` can only be used in combination with `scaleHeight` and `scaleWidth`.
The `scaleMode` parameter can be set to `cut` or `fit`. The default `scaleMode` is `cut`, the behavior of which is explained above. If you specify `fit` as the `scaleMode`, the system scales the image into the given box of dimensions while keeping the aspect ratio (possibly resulting in a smaller image in one dimension). |
| Overlay an image | `imageX` `imageY` `imageURI` | The `imageX` and `imageY` parameters are both integers. Valid values for these parameters are 0 or greater.
Supported formats are `png`, `jpg`, `jp2`, and `gif`.
The `imageURI` parameter can be set to the absolute path of the overlaid image. The value of the `imageURI` parameter must be given in proper URL encoding, and it cannot exceed 400 characters in length. The path may include query string parameters, which supports dynamically generating the overlaid image itself through this service; that is, the overlaid image can itself be a transformed image.
If the overlaid image extends over the primary image's boundaries, the overlaid image is cropped so that it fits directly over the primary image. |
| Crop an image | `cropX` `cropY` `cropWidth` `cropHeight` | The `cropX`, `cropY`, `cropWidth`, `cropHeight` parameters are integers. All four parameters must be specified to trigger a cropping operation.
Valid values for the `cropX` and `cropY` parameters are 0 or greater. If the crop location defined by `cropX` and `cropY` is outside the image area, nothing is cropped.
Valid values for the `cropWidth` and `cropHeight` parameters are 10 or greater. If the `cropWidth` and `cropHeight` parameters specify a size that is greater than the original image, the crop area is reduced to the actual image area. If `cropWidth` and `cropHeight` are 0 or less, no transformation is applied. |
| Format an image | `format` | The `format` parameter specifies the target format of the image. Supported formats are `png`, `jpg`, `jp2`, and `gif`. If no target format is specified, no format conversion is performed.
The source image file is references with attribute `relPath`. Source image's format is recognized by the file extension which must be `tif`, `tiff`, `jpg`, `jpeg`, `png`, or `gif`.
In the generated URL the file extension of the target format is used in the URL path. This is to make sure the image is loaded from an URL with a matching file extension. The source format is provided as URL parameter. |
| Adjust image compression quality | `quality` | The `quality` parameter specifies a quality setting for `jpg` and `jp2` images, and specifies the compression level for `png` images.
For `jpg` and `jp2` images, you can set values from 1–100 for the highest quality. The default quality is 80. If you're not changing the default quality, you don't need to pass in a value.
For `png` images, the quality setting has no effect on the appearance of the `png`, since the compression is always lossless. Instead you can use the quality setting to set the zlib compression level and filter-type for PNG images. The tens digit sets the zlib compression level(1-9). The ones digit sets the filter type.
If the `png` setting is not present or set to 0, it uses a default value of 75. If this setting is set to 100, it actually equals the quality setting 90. |
| Adjust Metadata stripping | `strip` | The `strip` parameter specifies if metadata like EXIF and color profiles is stripped from the image during transformation.
Valid values for the `strip` parameter are between `true` and `false`. The default is `true` |
| Change background color | `bgcolor(color) or bgcolor(color+alpha)` | The `bgcolor` parameter specifies the background color for images that support transparency as well as JPEG images when being converted from a format that supports transparency. Optionally, alpha setting for PNG images are also supported.
`bgcolor` expects a 6 digit hexadecimal value of RGB with an optional two hexadecimal characters representing alpha value that determines transparency.
FF0000 = Red
FF000077 = Red with 50% transparency
Alpha values are optional. When the alpha value is omitted, the resulting color is opaque. Alpha values are only valid when the image output format is PNG. |
Example:
The following code
`var url = URLUtils.imageURL('/somepath/image.png', {scaleWidth: 100, format: 'jpg'});`
will produce an image transformation URL like
`http:///.../on/demandware.static/.../somepath/image.jpg?sw=100&sfrm=png`.
## Constant Summary
| Constant | Description |
| --- | --- |
| [CONTEXT_CATALOG](#context_catalog): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "ContextCatalog" | ID for a catalog context. |
| [CONTEXT_LIBRARY](#context_library): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "ContextLibrary" | ID for a library context. |
| [CONTEXT_SITE](#context_site): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "ContextSite" | ID for a site context (= assigned cartridges). |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| ~~static [abs](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absboolean-urlaction-urlparameter)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md))~~ | Return an absolute URL with protocol and host from current request. |
| ~~static [abs](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absboolean-string-string)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Return an absolute URL with protocol and host from current request. |
| static [abs](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absurlaction-urlparameter)([URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)) | Return an absolute URL with protocol and host from the current request. |
| static [abs](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Return an absolute URL with protocol and host from current request. |
| static [absImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absimagestring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to absStatic( String ) this method returns a static URL for a resource in the current site. |
| static [absImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absimagestring-string-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to absStatic( String, String, String ) this method returns a static URL for a resource in the current site. |
| static [absStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absstaticstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | The method returns a static URL for a resource in the current site. |
| static [absStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absstaticstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the absolute URL to the static location of the specified context. |
| ~~static [absWebRoot](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#abswebroot)()~~ | Return an absolute web root URL with protocol and host same as the current request. |
| static [continueURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#continueurl)() | Return a URL, which can be used in combination with an Interaction Continue Node, to continue the user interface flow. |
| static [home](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#home)() | Generates a hostname-only url if an alias is set, or an url to the Home-Show pipeline in the default format using the protocol of the incoming request. |
| ~~static [http](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpboolean-urlaction-urlparameter)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md))~~ | Return an absolute URL with HTTP protocol. |
| ~~static [http](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpboolean-string-string)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Return an absolute URL with HTTP protocol. |
| static [http](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpurlaction-urlparameter)([URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)) | Return an absolute URL with HTTP protocol. |
| static [http](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Return an absolute URL with HTTP protocol. |
| static [httpContinue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpcontinue)() | Return a URL, which can be used in combination with an Interaction Continue Node, to continue the user interface flow. |
| static [httpHome](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httphome)() | Generates a hostname-only url if an alias is set, or an url to the Home-Show pipeline in the default format using the HTTP protocol. |
| static [httpImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpimagestring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to httpStatic( String ) this method returns a static URL for a resource in the current site. |
| static [httpImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpimagestring-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to httpStatic( String ) this method returns a static URL for a resource in the current site. |
| static [httpImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpimagestring-string-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to httpStatic( String, String, String ) this method returns a static URL for a resource in the current site. |
| static [httpImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpimagestring-string-string-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to httpStatic( String, String, String ) this method returns a static URL for a resource in the current site. |
| static [httpStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpstaticstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | The method returns a static URL for a resource in the current site. |
| static [httpStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpstaticstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | The method returns a static URL for a resource in the current site. |
| static [httpStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpstaticstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the absolute URL to the static location of the specified context. |
| static [httpStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpstaticstring-string-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the absolute URL to the static location of the specified context. |
| ~~static [httpWebRoot](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpwebroot)()~~ | Return an absolute web root URL with HTTP protocol and host information from current request. |
| ~~static [https](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsboolean-urlaction-urlparameter)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md))~~ | Return an absolute URL with HTTPS protocol. |
| ~~static [https](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsboolean-string-string)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Return an absolute URL with HTTPS protocol. |
| static [https](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsurlaction-urlparameter)([URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)) | Return an absolute URL with HTTPS protocol. |
| static [https](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Return an absolute URL with HTTPS protocol. |
| static [httpsContinue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpscontinue)() | Return a URL, which can be used in combination with an Interaction Continue Node, to continue the user interface flow. |
| static [httpsHome](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpshome)() | Generates a hostname-only url if an alias is set, or an url to the Home-Show pipeline in the default format using the HTTPS protocol. |
| static [httpsImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsimagestring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to httpsStatic( String ) this method returns a static URL for a resource in the current site. |
| static [httpsImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsimagestring-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to httpsStatic( String ) this method returns a static URL for a resource in the current site. |
| static [httpsImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsimagestring-string-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to httpsStatic( String, String, String ) this method returns a static URL for a resource in the current site. |
| static [httpsImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsimagestring-string-string-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to httpsStatic( String, String, String ) this method returns a static URL for a resource in the current site. |
| static [httpsStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsstaticstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | The method returns a static URL for a resource in the current site. |
| static [httpsStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsstaticstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | The method returns a static URL for a resource in the current site. |
| static [httpsStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsstaticstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the absolute URL to the static location of the specified context. |
| static [httpsStatic](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsstaticstring-string-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the absolute URL to the static location of the specified context. |
| ~~static [httpsWebRoot](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpswebroot)()~~ | Return an absolute web root URL with HTTPS protocol and host and domain information from the current request. |
| static [imageURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#imageurlstring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to staticURL( String ) this method returns a static URL for a resource in the current site. |
| static [imageURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#imageurlstring-string-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Similar to staticURL( String, String, String ) this method returns a static URL for a resource in the current site. |
| static [sessionRedirect](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#sessionredirectstring-url)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)) | This method is used to create a URL that redirects to a location in the current site with another host name. |
| static [sessionRedirectHttpOnly](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#sessionredirecthttponlystring-url)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)) | This method is used to create a URL that redirects to a location in the current site with another host name. |
| static [staticURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#staticurlstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | The method returns a static URL for a resource in the current site. |
| static [staticURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#staticurlstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the relative URL to the static location of the specified context. |
| ~~static [url](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#urlboolean-urlaction-urlparameter)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md))~~ | Return a relative URL. |
| ~~static [url](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#urlboolean-string-string)([Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Return a relative URL. |
| static [url](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#urlurlaction-urlparameter)([URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)) | Return a relative URL. |
| static [url](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#urlstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Return a relative URL. |
| ~~static [webRoot](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#webroot)()~~ | Return a relative web root URL. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### CONTEXT_CATALOG
- CONTEXT_CATALOG: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "ContextCatalog"
- : ID for a catalog context. See staticURL() method.
---
### CONTEXT_LIBRARY
- CONTEXT_LIBRARY: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "ContextLibrary"
- : ID for a library context. See staticURL() method.
---
### CONTEXT_SITE
- CONTEXT_SITE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "ContextSite"
- : ID for a site context (= assigned cartridges). See staticURL() method.
---
## Method Details
### abs(Boolean, URLAction, URLParameter...)
- ~~static abs(appendSID: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), action: [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), params: [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute URL with protocol and host from current request.
Note: The use of this method is deprecated, because session URL rewriting
is no longer supported. Use the corresponding abs() method without the
appendSID parameter instead.
**Parameters:**
- appendSID - when true the resulting URL will include session ID.
- action - URL action
- params - URL parameters
**Returns:**
- an absolute URL with protocol and host from current request.
**Deprecated:**
**warning:** Use [abs(URLAction, URLParameter...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absurlaction-urlparameter) instead.
---
### abs(Boolean, String, String...)
- ~~static abs(appendSID: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute URL with protocol and host from current request.
Note: The use of this method is deprecated, because session URL rewriting
is no longer supported. Use the corresponding method abs() without the
appendSID parameter instead.
**Parameters:**
- appendSID - when true the resulting URL will include session ID.
- action - the pipeline, which should be invoked, e.g.: 'Pipeline-StartNode'
- namesAndParams - several strings with name=value pairs, e.g.: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- an absolute URL with protocol and host from current request.
**Deprecated:**
**warning:** Use [abs(String, String...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absstring-string) instead.
---
### abs(URLAction, URLParameter...)
- static abs(action: [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), params: [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return an absolute URL with protocol and host from the current request.
**Parameters:**
- action - URL action
- params - URL parameters
**Returns:**
- an absolute URL with protocol and host from the current request.
---
### abs(String, String...)
- static abs(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return an absolute URL with protocol and host from current request.
**Parameters:**
- action - the pipeline, which should be invoked, e.g.: 'Pipeline-StartNode'
- namesAndParams - several strings with name=value pairs, for example: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- an absolute URL with protocol and host from current request.
---
### absImage(String, Object)
- static absImage(relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to absStatic( String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
**Parameters:**
- relPath - the relative path of the file
- transform - Object with transformation parameters (see class header)
**Returns:**
- the URL for the specified image resource
---
### absImage(String, String, String, Object)
- static absImage(context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to absStatic( String, String, String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
**Parameters:**
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
- transform - Object with transformation parameters (see class header)
**Returns:**
- URL for the specified location
---
### absStatic(String)
- static absStatic(relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : The method returns a static URL for a resource in the current site. Site
resources are actually located in the cartridges associated with the site.
This resources are typically logos, button images, CSS files and JavaScript
files. The method will transform the given relative path to include cache
related information, which enables better cache control.
The created URL is an absolute URL with same protocol as the current incoming
request.
Note: This method replaces the original mechanisms of using the webroot()
method to construct a URL. The new method is better integrated into the
overall cache management.
**Parameters:**
- relPath - the relative path of the file
**Returns:**
- the URL for the specified location
---
### absStatic(String, String, String)
- static absStatic(context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Returns the absolute URL to the static location of the specified context. The context
can be either a specific catalog (URLUtils.CONTEXT\_CATALOG),
a content library (URLUtils.CONTEXT\_LIBRARY) or a site (URLUtils.CONTEXT\_SITE).
Respectively either a URL to images in a catalog, a library or a site are created.
The contextID parameter is optional and only used for context CONTEXT\_CATALOG, where
is specifies the ID of a specific catalog. If defined, the static URL for the specified
catalog is returned. If not defined, the static URL for the current site catalog
is returned (or null if no site catalog is defined).
For context CONTEXT\_SITE and context CONTEXT\_LIBRARY, the contextID parameter is
ignored and the static URL for the current site / site library is returned.
Parameter relPath can be defined to specify the relative path within the context-specific
path.
The method returns an absolute URL with the same protocol as the current request.
**Parameters:**
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
**Returns:**
- URL for the specified location
---
### absWebRoot()
- ~~static absWebRoot(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute web root URL with protocol and host same as the current request.
Note: The use of this method is deprecated. The method absStatic() should
be used instead. It provides better cache integration.
**Returns:**
- an absolute web root URL with protocol, host from current request.
**Deprecated:**
**warning:** Use [absStatic(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absstaticstring) or [absStatic(String, String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#absstaticstring-string-string) instead.
---
### continueURL()
- static continueURL(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return a URL, which can be used in combination with an Interaction Continue Node, to
continue the user interface flow.
**Returns:**
- an absolute URL with protocol and host from current context request.
---
### home()
- static home(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Generates a hostname-only url if an alias is set, or an url to the Home-Show
pipeline in the default format using the protocol of the incoming request.
**Returns:**
- a hostname-only url if an alias is set, or an url to the Home-Show
pipeline in the default format using the protocol of the incoming request.
Uses the default locale of the site making the request.
---
### http(Boolean, URLAction, URLParameter...)
- ~~static http(appendSID: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), action: [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), params: [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute URL with HTTP protocol. If an HTTP host is configured in the preferences
the returned URL will include that host, otherwise, the host from current request is used.
Note: The use of this method is deprecated, because session URL rewriting
is no longer supported. Use the corresponding http() method without the
appendSID parameter instead.
**Parameters:**
- appendSID - when true the resulting URL will include session ID.
- action - URL action
- params - URL parameters
**Returns:**
- an absolute URL with HTTP protocol.
**Deprecated:**
**warning:** Use [http(URLAction, URLParameter...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpurlaction-urlparameter) instead.
---
### http(Boolean, String, String...)
- ~~static http(appendSID: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute URL with HTTP protocol. If an HTTP host is configured in the preferences
the returned URL will include that host, otherwise, the host from current request is used.
Note: The use of this method is deprecated, because session URL rewriting
is no longer supported. Use the corresponding http() method without the
appendSID parameter instead.
**Parameters:**
- appendSID - when true the resulting URL will include session ID.
- action - the pipeline, which should be invoked, e.g.: 'Pipeline-StartNode'
- namesAndParams - several strings with name=value pairs, e.g.: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- an absolute URL with HTTP protocol.
**Deprecated:**
**warning:** Use [http(String, String...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpstring-string) instead.
---
### http(URLAction, URLParameter...)
- static http(action: [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), params: [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return an absolute URL with HTTP protocol. If an HTTP host is configured in the preferences
the returned URL will include that host, otherwise, the host from current request is used.
**Parameters:**
- action - URL action
- params - URL parameters
**Returns:**
- an absolute URL with HTTP protocol.
---
### http(String, String...)
- static http(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return an absolute URL with HTTP protocol. If an HTTP host is configured in the preferences
the returned URL will include that host, otherwise, the host from current request is used.
**Parameters:**
- action - the pipeline, which should be invoked, e.g.: 'Pipeline-StartNode'
- namesAndParams - several strings with name=value pairs, e.g.: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- an absolute URL with HTTP protocol.
---
### httpContinue()
- static httpContinue(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return a URL, which can be used in combination with an Interaction Continue Node, to
continue the user interface flow. For security reasons the httpContinue() function returns
a HTTPS continue URL if the interaction flow has started with a HTTPS request. Otherwise a
HTTP continue URL is returned.
If an HTTP/HTTPS host is configured in the preferences the returned URL will include that
host, otherwise, the host from current request is used.
**Returns:**
- an absolute URL with HTTP protocol.
---
### httpHome()
- static httpHome(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Generates a hostname-only url if an alias is set, or an url to the Home-Show
pipeline in the default format using the HTTP protocol.
**Returns:**
- a hostname-only url if an alias is set, or an url to the Home-Show
pipeline in the default format using the HTTP protocol.
---
### httpImage(String, Object)
- static httpImage(relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to httpStatic( String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
**Parameters:**
- relPath - the relative path of the file
- transform - Object with transformation parameters (see class header)
**Returns:**
- the URL for the specified location
---
### httpImage(String, String, Object)
- static httpImage(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to httpStatic( String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
The host parameter is optional. If provided, then this host name will be used
in precedence to the host name provided by the current request. The specified host
name must be defined in the alias settings for the site, otherwise an exception will
be thrown.
**Parameters:**
- host - Optional host name, used to set the host explicitly.
- relPath - the relative path of the file
- transform - Object with transformation parameters
**Returns:**
- the URL for the specified location
---
### httpImage(String, String, String, Object)
- static httpImage(context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to httpStatic( String, String, String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
**Parameters:**
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
- transform - Object with transformation parameters (see class header)
**Returns:**
- URL for the specified location
---
### httpImage(String, String, String, String, Object)
- static httpImage(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to httpStatic( String, String, String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
The host parameter is optional. If provided, then this host name will be used
in precedence to the host name provided by the current request. The specified host
name must be defined in the alias settings for the site, otherwise an exception will
be thrown.
**Parameters:**
- host - Optional host name, used to set the host explicitly.
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
- transform - Object with transformation parameters
**Returns:**
- URL for the specified location
---
### httpStatic(String)
- static httpStatic(relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : The method returns a static URL for a resource in the current site. Site
resources are actually located in the cartridges associated with the site.
This resources are typically logos, button images, CSS files and JavaScript
files. The method will transform the given relative path to include cache
related information, which enables better cache control.
The created URL is an absolute URL with HTTP protocol.
Note: This method replaces the original mechanisms of using the webroot()
method to construct a URL. The new method is better integrated into the
overall cache management.
**Parameters:**
- relPath - the relative path of the file
**Returns:**
- the URL for the specified location
---
### httpStatic(String, String)
- static httpStatic(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : The method returns a static URL for a resource in the current site. Site
resources are actually located in the cartridges associated with the site.
This resources are typically logos, button images, CSS files and JavaScript
files. The method will transform the given relative path to include cache
related information, which enables better cache control.
The host parameter is optional. If provided, then this host name will be used
in precedence to the host name provided by the current request. The specified host
name must be defined in the alias settings for the site, otherwise an exception will
be thrown.
The created URL is an absolute URL with HTTP protocol.
Note: This method replaces the original mechanisms of using the webroot()
method to construct a URL. The new method is better integrated into the
overall cache management.
**Parameters:**
- host - Optional host name, used to set the host explicitly.
- relPath - the relative path of the file
**Returns:**
- the URL for the specified location
---
### httpStatic(String, String, String)
- static httpStatic(context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Returns the absolute URL to the static location of the specified context. The context
can be either a specific catalog (URLUtils.CONTEXT\_CATALOG),
a content library (URLUtils.CONTEXT\_LIBRARY) or a site (URLUtils.CONTEXT\_SITE).
Respectively either a URL to images in a catalog, a library or a site are created.
The contextID parameter is optional and only used for context CONTEXT\_CATALOG, where
is specifies the ID of a specific catalog. If defined, the static URL for the specified
catalog is returned. If not defined, the static URL for the current site catalog
is returned (or null if no site catalog is defined).
For context CONTEXT\_SITE and context CONTEXT\_LIBRARY, the contextID parameter is
ignored and the static URL for the current site / site library is returned.
Parameter relPath can be defined to specify the relative path within the context-specific
path.
The method returns an absolute URL with HTTP protocol.
**Parameters:**
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
**Returns:**
- URL for the specified location
---
### httpStatic(String, String, String, String)
- static httpStatic(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Returns the absolute URL to the static location of the specified context. The context
can be either a specific catalog (URLUtils.CONTEXT\_CATALOG),
a content library (URLUtils.CONTEXT\_LIBRARY) or a site (URLUtils.CONTEXT\_SITE).
Respectively either a URL to images in a catalog, a library or a site are created.
The host parameter is optional. If provided, then this host name will be used
in precedence to the host name provided by the current request. The specified host
name must be defined in the alias settings for the site, otherwise an exception will
be thrown.
The contextID parameter is optional and only used for context CONTEXT\_CATALOG, where
is specifies the ID of a specific catalog. If defined, the static URL for the specified
catalog is returned. If not defined, the static URL for the current site catalog
is returned (or null if no site catalog is defined).
For context CONTEXT\_SITE and context CONTEXT\_LIBRARY, the contextID parameter is
ignored and the static URL for the current site / site library is returned.
Parameter relPath can be defined to specify the relative path within the context-specific
path.
The method returns an absolute URL with HTTP protocol.
**Parameters:**
- host - Optional host name, used to set the host explicitly.
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
**Returns:**
- URL for the specified location
---
### httpWebRoot()
- ~~static httpWebRoot(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute web root URL with HTTP protocol and host information from current
request. If an HTTP host is configured in the preferences the returned URL will include
that host.
Note: The use of this method is deprecated. The method httpStatic() should
be used instead. It provides better cache integration.
**Returns:**
- an absolute web root URL with HTTP protocol and host information from the current
request.
**Deprecated:**
**warning:** Use the [httpStatic(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpstaticstring) or [httpStatic(String, String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpstaticstring-string-string) methods instead.
---
### https(Boolean, URLAction, URLParameter...)
- ~~static https(appendSID: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), action: [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), params: [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute URL with HTTPS protocol. If an HTTPS host is configured in the preferences
the returned URL will include that host, otherwise, the host from current request is used.
Note: The use of this method is deprecated, because session URL rewriting
is no longer supported. Use the corresponding https() method without the
appendSID parameter instead.
**Parameters:**
- appendSID - when true the resulting URL will include session ID.
- action - URL action
- params - URL parameters
**Returns:**
- an absolute URL with HTTPS protocol.
**Deprecated:**
**warning:** Use the [https(URLAction, URLParameter...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsurlaction-urlparameter) method instead.
---
### https(Boolean, String, String...)
- ~~static https(appendSID: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute URL with HTTPS protocol. If an HTTPS host is configured in the preferences
the returned URL will include that host, otherwise, the host from current request is used.
Note: The use of this method is deprecated, because session URL rewriting
is no longer supported. Use the corresponding https() method without the
appendSID parameter instead.
**Parameters:**
- appendSID - when true the resulting URL will include session ID
- action - the pipeline, which should be invoked, e.g.: 'Pipeline-StartNode'
- namesAndParams - several strings with name=value pairs, e.g.: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- an absolute URL with HTTPS protocol.
**Deprecated:**
**warning:** Use the [https(String, String...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsstring-string) method instead.
---
### https(URLAction, URLParameter...)
- static https(action: [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), params: [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return an absolute URL with HTTPS protocol. If an HTTPS host is configured in the preferences
the returned URL will include that host, otherwise, the host from current request is used.
**Parameters:**
- action - URL action
- params - URL parameters
**Returns:**
- an absolute URL with HTTPS protocol.
---
### https(String, String...)
- static https(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return an absolute URL with HTTPS protocol. If an HTTPS host is configured in the preferences
the returned URL will include that host, otherwise, the host from current request is used.
**Parameters:**
- action - the pipeline, which should be invoked, e.g.: 'Pipeline-StartNode'
- namesAndParams - several strings with name=value pairs, e.g.: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- an absolute URL with HTTPS protocol.
---
### httpsContinue()
- static httpsContinue(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return a URL, which can be used in combination with an Interaction Continue Node, to
continue the user interface flow. An absolute URL with HTTPS protocol is returned.
If an HTTPS host is configured in the preferences the returned URL will include that
host, otherwise, the host from current request is used.
**Returns:**
- an absolute URL with HTTPS protocol.
---
### httpsHome()
- static httpsHome(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Generates a hostname-only url if an alias is set, or an url to the Home-Show
pipeline in the default format using the HTTPS protocol.
**Returns:**
- a hostname-only url if an alias is set, or an url to the Home-Show
pipeline in the default format using the HTTPS protocol..
---
### httpsImage(String, Object)
- static httpsImage(relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to httpsStatic( String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
**Parameters:**
- relPath - the relative path of the file
- transform - Object with transformation parameters (see class header)
**Returns:**
- the URL for the specified location
---
### httpsImage(String, String, Object)
- static httpsImage(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to httpsStatic( String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
The host parameter is optional. If provided, then this host name will be used
in precedence to the host name provided by the current request. The specified host
name must be defined in the alias settings for the site, otherwise an exception will
be thrown.
**Parameters:**
- host - Optional host name, used to set the host explicitly.
- relPath - the relative path of the file
- transform - Object with transformation parameters
**Returns:**
- the URL for the specified location
---
### httpsImage(String, String, String, Object)
- static httpsImage(context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to httpsStatic( String, String, String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
**Parameters:**
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
- transform - Object with transformation parameters (see class header)
**Returns:**
- URL for the specified location
---
### httpsImage(String, String, String, String, Object)
- static httpsImage(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to httpsStatic( String, String, String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
The host parameter is optional. If provided, then this host name will be used
in precedence to the host name provided by the current request. The specified host
name must be defined in the alias settings for the site, otherwise an exception will
be thrown.
**Parameters:**
- host - Optional host name, used to set the host explicitly.
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
- transform - Object with transformation parameters
**Returns:**
- URL for the specified location
---
### httpsStatic(String)
- static httpsStatic(relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : The method returns a static URL for a resource in the current site. Site
resources are actually located in the cartridges associated with the site.
This resources are typically logos, button images, CSS files and JavaScript
files. The method will transform the given relative path to include cache
related information, which enables better cache control.
The created URL is an absolute URL with HTTPS protocol.
Note: This method replaces the original mechanisms of using the webroot()
method to construct a URL. The new method is better integrated into the
overall cache management.
**Parameters:**
- relPath - the relative path of the file
**Returns:**
- the URL for the specified location
---
### httpsStatic(String, String)
- static httpsStatic(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : The method returns a static URL for a resource in the current site. Site
resources are actually located in the cartridges associated with the site.
This resources are typically logos, button images, CSS files and JavaScript
files. The method will transform the given relative path to include cache
related information, which enables better cache control.
The host parameter is optional. If provided, then this host name will be used
in precedence to the host name provided by the current request. The specified host
name must be defined in the alias settings for the site, otherwise an exception will
be thrown.
The created URL is an absolute URL with HTTPS protocol.
Note: This method replaces the original mechanisms of using the webroot()
method to construct a URL. The new method is better integrated into the
overall cache management.
**Parameters:**
- host - Optional host name, used to set the host explicitly.
- relPath - the relative path of the file
**Returns:**
- the URL for the specified location
---
### httpsStatic(String, String, String)
- static httpsStatic(context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Returns the absolute URL to the static location of the specified context. The context
can be either a specific catalog (URLUtils.CONTEXT\_CATALOG),
a content library (URLUtils.CONTEXT\_LIBRARY) or a site (URLUtils.CONTEXT\_SITE).
Respectively either a URL to images in a catalog, a library or a site are created.
The contextID parameter is optional and only used for context CONTEXT\_CATALOG, where
is specifies the ID of a specific catalog. If defined, the static URL for the specified
catalog is returned. If not defined, the static URL for the current site catalog
is returned (or null if no site catalog is defined).
For context CONTEXT\_SITE and context CONTEXT\_LIBRARY, the contextID parameter is
ignored and the static URL for the current site / site library is returned.
Parameter relPath can be defined to specify the relative path within the context-specific
path.
The method returns an absolute URL with HTTPS protocol.
**Parameters:**
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
**Returns:**
- URL for the specified location
---
### httpsStatic(String, String, String, String)
- static httpsStatic(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Returns the absolute URL to the static location of the specified context. The context
can be either a specific catalog (URLUtils.CONTEXT\_CATALOG),
a content library (URLUtils.CONTEXT\_LIBRARY) or a site (URLUtils.CONTEXT\_SITE).
Respectively either a URL to images in a catalog, a library or a site are created.
The host parameter is optional. If provided, then this host name will be used
in precedence to the host name provided by the current request. The specified host
name must be defined in the alias settings for the site, otherwise an exception will
be thrown.
The contextID parameter is optional and only used for context CONTEXT\_CATALOG, where
is specifies the ID of a specific catalog. If defined, the static URL for the specified
catalog is returned. If not defined, the static URL for the current site catalog
is returned (or null if no site catalog is defined).
For context CONTEXT\_SITE and context CONTEXT\_LIBRARY, the contextID parameter is
ignored and the static URL for the current site / site library is returned.
Parameter relPath can be defined to specify the relative path within the context-specific
path.
The method returns an absolute URL with HTTPS protocol.
**Parameters:**
- host - Optional host name, used to set the host explicitly.
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
**Returns:**
- URL for the specified location
---
### httpsWebRoot()
- ~~static httpsWebRoot(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return an absolute web root URL with HTTPS protocol and host and domain information from the current
request. If an HTTP host is configured in the preferences the returned URL will include that host.
Note: The use of this method is deprecated. The method httpsStatic() should
be used instead. It provides better cache integration.
**Returns:**
- an absolute web root URL with HTTPS protocol and host information from the current
request.
**Deprecated:**
**warning:** Use the [httpsStatic(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsstaticstring) or [httpsStatic(String, String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#httpsstaticstring-string-string) method instead.
---
### imageURL(String, Object)
- static imageURL(relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to staticURL( String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
The URL returned is always an absolute URL.
**Parameters:**
- relPath - the relative path of the file
- transform - Object with transformation parameters (see class header)
**Returns:**
- the URL for the specified location
---
### imageURL(String, String, String, Object)
- static imageURL(context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transform: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Similar to staticURL( String, String, String ) this method returns a static URL for a resource
in the current site. The method assumes, that the URL refers to an image an
supports an additional parameter with optional image transformation parameters.
The image transformation parameters must be specified as JavaScript object literal.
The URL returned is always an absolute URL.
**Parameters:**
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id
- relPath - Relative path within the catalog or library
- transform - Object with transformation parameters (see class header)
**Returns:**
- URL for the specified location
---
### sessionRedirect(String, URL)
- static sessionRedirect(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), url: [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : This method is used to create a URL that redirects to a location in
the current site with another host name. When the URL is submitted,
the system copies all system cookies, such that user, session and basket
information are shared across different hosts.
The specified host name must be defined in the alias settings for the site,
otherwise an exception will be thrown when submitting the redirect URL.
If the specified host is the same as the current host, the method will return
a "normal" URL because no redirect is required.
**Parameters:**
- host - Target host with or without a site-path
- url - Target URL on current site (relative or absolute), pass null to redirect to new host only
**Returns:**
- an absolute secure URL to the redirect mechanism
---
### sessionRedirectHttpOnly(String, URL)
- static sessionRedirectHttpOnly(host: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), url: [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : This method is used to create a URL that redirects to a location in
the current site with another host name. When the URL is submitted,
the system copies all system cookies, such that user, session and basket
information are shared across different hosts.
The specified host name must be defined in the alias settings for the site,
otherwise an exception will be thrown when submitting the redirect URL.
If the specified host is the same as the current host, the method will return
a "normal" URL because no redirect is required.
**Note:** since this method generates a non-secure (HTTP) link, no
HTTPS Cookies are copied, which might lead to sessions being incorrectly being
detected as hijacked. It is strongly recommended to use [sessionRedirect(String, URL)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#sessionredirectstring-url)
where possible.
**Parameters:**
- host - Target host with or without a site-path
- url - Target URL on current site (relative or absolute), pass null to redirect to new host only
**Returns:**
- an absolute URL to the redirect mechanism
---
### staticURL(String)
- static staticURL(relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : The method returns a static URL for a resource in the current site. Site
resources are actually located in the cartridges associated with the site.
This resources are typically logos, button images, CSS files and JavaScript
files. The method will transform the given relative path to include cache
related information, which enables better cache control.
The created URL is a relative URL.
Note: This method replaces the original mechanisms of using the webroot()
method to construct a URL. The new method is better integrated into the
overall cache management.
**Parameters:**
- relPath - the relative path of the file
**Returns:**
- the URL for the specified location
---
### staticURL(String, String, String)
- static staticURL(context: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contextID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), relPath: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Returns the relative URL to the static location of the specified context. The context
can be either a specific catalog (URLUtils.CONTEXT\_CATALOG),
a content library (URLUtils.CONTEXT\_LIBRARY) or a site (URLUtils.CONTEXT\_SITE).
Respectively either a URL to images in a catalog, a library or a site are created.
The contextID parameter is optional and can be used with context either CONTEXT\_CATALOG or CONTEXT\_LIBRARY, where
it specifies the ID of a specific catalog or a shared library respectively. If defined, the static URL for the specified
catalog/shared library is returned. If not defined, the static URL for the current site catalog/site library
is returned (or null if no site catalog/site library is defined).
For context CONTEXT\_SITE, the contextID parameter is ignored and the static URL for the current site is returned.
Parameter relPath can be defined to specify the relative path within the context-specific
path.
The method returns an relative URL with the same protocol as the current request.
**Parameters:**
- context - Either CONTEXT\_CATALOG, CONTEXT\_LIBRARY or CONTEXT\_SITE
- contextID - Optional context id, currently only used to specify a catalog id or a shared library id
- relPath - Relative path within the catalog or library or site
**Returns:**
- URL for the specified location
---
### url(Boolean, URLAction, URLParameter...)
- ~~static url(appendSID: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), action: [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), params: [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return a relative URL.
Note: The use of this method is deprecated, because session URL rewriting
is no longer supported. Use the corresponding url() method without the
appendSID parameter instead.
**Parameters:**
- appendSID - when true the resulting URL will include session ID.
- action - URL action
- params - URL parameters
**Returns:**
- a relative URL.
**Deprecated:**
**warning:** Use [url(URLAction, URLParameter...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#urlurlaction-urlparameter) instead.
---
### url(Boolean, String, String...)
- ~~static url(appendSID: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return a relative URL.
Note: The use of this method is deprecated, because session URL rewriting
is no longer supported. Use the corresponding url() method without the
appendSID parameter instead.
**Parameters:**
- appendSID - when true the resulting URL will include session ID.
- action - the pipeline, which should be invoked, e.g.: 'Pipeline-StartNode'
- namesAndParams - several strings with name=value pairs, e.g.: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- a relative URL.
**Deprecated:**
**warning:** Use [url(String, String...)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#urlstring-string) instead.
---
### url(URLAction, URLParameter...)
- static url(action: [URLAction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLAction.md), params: [URLParameter...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLParameter.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return a relative URL.
**Parameters:**
- action - URL action
- params - URL parameters
**Returns:**
- a relative URL.
---
### url(String, String...)
- static url(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)
- : Return a relative URL.
**Parameters:**
- action - the pipeline, which should be invoked, e.g.: 'Pipeline-StartNode'
- namesAndParams - several strings with name=value pairs , e.g.: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- a relative URL.
---
### webRoot()
- ~~static webRoot(): [URL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URL.md)~~
- : Return a relative web root URL. A web root URL is used to access all static
media context for the site. The actual media file can be referenced by appending
a relative path.
Note: The use of this method is deprecated. The method staticURL() should
be used instead. It provides better cache integration.
**Returns:**
- a relative web root URL.
**Deprecated:**
**warning:** Use the [staticURL(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#staticurlstring) or the [staticURL(String, String, String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.web.URLUtils.md#staticurlstring-string-string) method instead.
---
# Class UUIDUtils
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.util.UUIDUtils](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.UUIDUtils.md)
Utility methods around generating unique IDs.
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [createUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.UUIDUtils.md#createuuid)() | The method generates a unique id. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Method Details
### createUUID()
- static createUUID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The method generates a unique id.
**Returns:**
- the generated unique id
---
# Class Variant
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- [dw.object.ExtensibleObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md)
- [dw.catalog.Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md)
- [dw.catalog.Variant](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md)
Represents a variant of a product variation. If the variant does not define an own value,
the value is retrieved by fallback from variation groups (sorted by their position) or the
variation master.
## Property Summary
| Property | Description |
| --- | --- |
| [EAN](#ean): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the EAN of the product variant. |
| [UPC](#upc): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the UPC of the product variant. |
| [allProductLinks](#allproductlinks): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns all product links of the product variant. |
| [brand](#brand): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the brand of the product variant. |
| [classificationCategory](#classificationcategory): [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) `(read-only)` | Returns the classification category of the product variant. |
| [custom](#custom): [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md) `(read-only)` | Returns the custom attributes of the variant. |
| [image](#image): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)` | Returns the image of the product variant. |
| [longDescription](#longdescription): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)` | Returns the long description of the product variant. |
| [manufacturerName](#manufacturername): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the manufacturer name of the product variant. |
| [manufacturerSKU](#manufacturersku): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the manufacturer sku of the product variant. |
| [masterProduct](#masterproduct): [Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md) `(read-only)` | Returns the ProductMaster for this mastered product. |
| [name](#name): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the name of the product variant. |
| [onlineFrom](#onlinefrom): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)` | Returns the onlineFrom date of the product variant. |
| [onlineTo](#onlineto): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)` | Returns the onlineTo date of the product variant. |
| [optionProduct](#optionproduct): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns 'true' if the variant has any options, otherwise 'false'. |
| [pageDescription](#pagedescription): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the pageDescription of the product variant. |
| [pageKeywords](#pagekeywords): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the pageKeywords of the product variant. |
| [pageTitle](#pagetitle): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the pageTitle of the product variant. |
| [pageURL](#pageurl): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the pageURL of the product variant. |
| [productLinks](#productlinks): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns all product links of the product variant for which the target product is assigned to the current site catalog. |
| [shortDescription](#shortdescription): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)` | Returns the short description of the product variant. |
| [taxClassID](#taxclassid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the tax class id of the product variant. |
| [template](#template): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the rendering template name of the product variant. |
| [thumbnail](#thumbnail): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)` | Returns the thumbnail image of the product variant. |
| [unit](#unit): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the sales unit of the product variant as defined by the master product. |
| [unitQuantity](#unitquantity): [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md) `(read-only)` | Returns the unitQuantity of the product variant as defined by the master product. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getAllProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getallproductlinks)() | Returns all product links of the product variant. |
| [getAllProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getallproductlinksnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns all product links of the specified type of the product variant. |
| [getBrand](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getbrand)() | Returns the brand of the product variant. |
| [getClassificationCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getclassificationcategory)() | Returns the classification category of the product variant. |
| [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getcustom)() | Returns the custom attributes of the variant. |
| [getEAN](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getean)() | Returns the EAN of the product variant. |
| [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getimage)() | Returns the image of the product variant. |
| [getLongDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getlongdescription)() | Returns the long description of the product variant. |
| [getManufacturerName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getmanufacturername)() | Returns the manufacturer name of the product variant. |
| [getManufacturerSKU](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getmanufacturersku)() | Returns the manufacturer sku of the product variant. |
| [getMasterProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getmasterproduct)() | Returns the ProductMaster for this mastered product. |
| [getName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getname)() | Returns the name of the product variant. |
| [getOnlineFrom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getonlinefrom)() | Returns the onlineFrom date of the product variant. |
| [getOnlineTo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getonlineto)() | Returns the onlineTo date of the product variant. |
| [getPageDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getpagedescription)() | Returns the pageDescription of the product variant. |
| [getPageKeywords](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getpagekeywords)() | Returns the pageKeywords of the product variant. |
| [getPageTitle](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getpagetitle)() | Returns the pageTitle of the product variant. |
| [getPageURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getpageurl)() | Returns the pageURL of the product variant. |
| [getProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getproductlinks)() | Returns all product links of the product variant for which the target product is assigned to the current site catalog. |
| [getProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getproductlinksnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns all product links of the specified type of the product variant for which the target product is assigned to the current site catalog. |
| [getRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getrecommendationsnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Retrieve the sorted collection of recommendations of the specified type for this product variant. |
| [getShortDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getshortdescription)() | Returns the short description of the product variant. |
| [getTaxClassID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#gettaxclassid)() | Returns the tax class id of the product variant. |
| [getTemplate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#gettemplate)() | Returns the rendering template name of the product variant. |
| [getThumbnail](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getthumbnail)() | Returns the thumbnail image of the product variant. |
| [getUPC](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getupc)() | Returns the UPC of the product variant. |
| [getUnit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getunit)() | Returns the sales unit of the product variant as defined by the master product. |
| [getUnitQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#getunitquantity)() | Returns the unitQuantity of the product variant as defined by the master product. |
| [isOptionProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Variant.md#isoptionproduct)() | Returns 'true' if the variant has any options, otherwise 'false'. |
### Methods inherited from class Product
[assignedToCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#assignedtocategorycategory), [getActiveData](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getactivedata), [getAllCategories](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallcategories), [getAllCategoryAssignments](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallcategoryassignments), [getAllIncomingProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallincomingproductlinks), [getAllIncomingProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallincomingproductlinksnumber), [getAllProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallproductlinks), [getAllProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallproductlinksnumber), [getAllRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallrecommendationscatalog), [getAllRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallrecommendationscatalog-number), [getAttributeModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getattributemodel), [getAvailabilityModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getavailabilitymodel), [getAvailabilityModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getavailabilitymodelproductinventorylist), [getAvailableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getavailableflag), [getBrand](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getbrand), [getBundledProductQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getbundledproductquantityproduct), [getBundledProducts](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getbundledproducts), [getBundles](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getbundles), [getCategories](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getcategories), [getCategoryAssignment](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getcategoryassignmentcategory), [getCategoryAssignments](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getcategoryassignments), [getClassificationCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getclassificationcategory), [getEAN](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getean), [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getid), [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getimage), [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getimagestring), [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getimagestring-number), [getImages](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getimagesstring), [getIncomingProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getincomingproductlinks), [getIncomingProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getincomingproductlinksnumber), [getLongDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getlongdescription), [getManufacturerName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getmanufacturername), [getManufacturerSKU](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getmanufacturersku), [getMinOrderQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getminorderquantity), [getName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getname), [getOnlineCategories](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getonlinecategories), [getOnlineFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getonlineflag), [getOnlineFrom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getonlinefrom), [getOnlineTo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getonlineto), [getOptionModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getoptionmodel), [getOrderableRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getorderablerecommendations), [getOrderableRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getorderablerecommendationsnumber), [getPageDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagedescription), [getPageKeywords](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagekeywords), [getPageMetaTag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagemetatagstring), [getPageMetaTags](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagemetatags), [getPageTitle](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagetitle), [getPageURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpageurl), [getPriceModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpricemodel), [getPriceModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpricemodelproductoptionmodel), [getPrimaryCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getprimarycategory), [getPrimaryCategoryAssignment](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getprimarycategoryassignment), [getProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getproductlinks), [getProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getproductlinksnumber), [getProductSetProducts](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getproductsetproducts), [getProductSets](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getproductsets), [getRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getrecommendations), [getRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getrecommendationsnumber), [getSearchPlacement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsearchplacement), [getSearchRank](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsearchrank), [getSearchableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsearchableflag), [getSearchableIfUnavailableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsearchableifunavailableflag), [getShortDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getshortdescription), [getSiteMapChangeFrequency](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsitemapchangefrequency), [getSiteMapIncluded](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsitemapincluded), [getSiteMapPriority](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsitemappriority), [getStepQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getstepquantity), [getStoreReceiptName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getstorereceiptname), [getStoreTaxClass](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getstoretaxclass), [getTaxClassID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#gettaxclassid), [getTemplate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#gettemplate), [getThumbnail](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getthumbnail), [getUPC](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getupc), [getUnit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getunit), [getUnitQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getunitquantity), [getVariants](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getvariants), [getVariationGroups](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getvariationgroups), [getVariationModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getvariationmodel), [includedInBundle](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#includedinbundleproduct), [isAssignedToCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isassignedtocategorycategory), [isAssignedToSiteCatalog](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isassignedtositecatalog), [isAvailable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isavailable), [isBundle](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isbundle), [isBundled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isbundled), [isCategorized](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#iscategorized), [isFacebookEnabled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isfacebookenabled), [isMaster](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#ismaster), [isOnline](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isonline), [isOptionProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isoptionproduct), [isPinterestEnabled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#ispinterestenabled), [isProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isproduct), [isProductSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isproductset), [isProductSetProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isproductsetproduct), [isRetailSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isretailset), [isSearchable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#issearchable), [isSiteProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#issiteproduct), [isVariant](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isvariant), [isVariationGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isvariationgroup), [setAvailableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setavailableflagboolean), [setOnlineFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setonlineflagboolean---variant-1), [setOnlineFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setonlineflagboolean---variant-2), [setSearchPlacement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchplacementnumber---variant-1), [setSearchPlacement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchplacementnumber---variant-2), [setSearchRank](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchranknumber---variant-1), [setSearchRank](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchranknumber---variant-2), [setSearchableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchableflagboolean---variant-1), [setSearchableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchableflagboolean---variant-2)
### Methods inherited from class ExtensibleObject
[describe](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#describe), [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#getcustom)
### Methods inherited from class PersistentObject
[getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### EAN
- EAN: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the EAN of the product variant.
If the variant does not define an own value for 'EAN', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'EAN', the value of
the master product is returned.
---
### UPC
- UPC: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the UPC of the product variant.
If the variant does not define an own value for 'UPC', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'UPC', the value of
the master product is returned.
---
### allProductLinks
- allProductLinks: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns all product links of the product variant.
If the variant does not define any product links, the product links are retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define any product links, the product links are
retrieved from the master product.
---
### brand
- brand: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the brand of the product variant.
If the variant does not define an own value for 'brand', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'brand', the value of
the master product is returned.
---
### classificationCategory
- classificationCategory: [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) `(read-only)`
- : Returns the classification category of the product variant.
**Please note** that the classification category is always inherited
from the master and cannot be overridden by the variant.
---
### custom
- custom: [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md) `(read-only)`
- : Returns the custom attributes of the variant.
Custom attributes are inherited from the master product and can
be overridden by the variant.
---
### image
- image: [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)`
- : Returns the image of the product variant.
If the variant does not define an own value for 'image', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'image', the value of
the master product is returned.
---
### longDescription
- longDescription: [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`
- : Returns the long description of the product variant.
If the variant does not define an own value for 'longDescription', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'longDescription', the value of
the master product is returned.
---
### manufacturerName
- manufacturerName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the manufacturer name of the product variant.
If the variant does not define an own value for 'manufacturerName', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'manufacturerName', the value of
the master product is returned.
---
### manufacturerSKU
- manufacturerSKU: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the manufacturer sku of the product variant.
If the variant does not define an own value for 'manufacturerSKU', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'manufacturerSKU', the value of
the master product is returned.
---
### masterProduct
- masterProduct: [Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md) `(read-only)`
- : Returns the ProductMaster for this mastered product.
---
### name
- name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the name of the product variant.
If the variant does not define an own value for 'name', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'name', the value of
the master product is returned.
---
### onlineFrom
- onlineFrom: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)`
- : Returns the onlineFrom date of the product variant.
If the variant does not define an own value for 'onlineFrom', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'onlineFrom', the value of
the master product is returned.
---
### onlineTo
- onlineTo: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)`
- : Returns the onlineTo date of the product variant.
If the variant does not define an own value for 'onlineTo', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'onlineTo', the value of
the master product is returned.
---
### optionProduct
- optionProduct: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns 'true' if the variant has any options, otherwise 'false'.
Method also returns 'true' if the variant has not any options,
but the related variation groups (sorted by position) or
master product has options.
---
### pageDescription
- pageDescription: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the pageDescription of the product variant.
If the variant does not define an own value for 'pageDescription', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'pageDescription', the value of
the master product is returned.
---
### pageKeywords
- pageKeywords: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the pageKeywords of the product variant.
If the variant does not define an own value for 'pageKeywords', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'pageKeywords', the value of
the master product is returned.
---
### pageTitle
- pageTitle: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the pageTitle of the product variant.
If the variant does not define an own value for 'pageTitle', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'pageTitle', the value of
the master product is returned.
---
### pageURL
- pageURL: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the pageURL of the product variant.
If the variant does not define an own value for 'pageURL', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'pageURL', the value of
the master product is returned.
---
### productLinks
- productLinks: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns all product links of the product variant for which the target
product is assigned to the current site catalog.
If the variant does not define any product links, the product links are retrieved
from the assigned variation groups, sorted by their position
If none of the variation groups define any product links, the product links are retrieved
from the master product.
---
### shortDescription
- shortDescription: [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`
- : Returns the short description of the product variant.
If the variant does not define an own value for 'shortDescription', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'shortDescription', the value of
the master product is returned.
---
### taxClassID
- taxClassID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the tax class id of the product variant.
If the variant does not define an own value for 'taxClassID', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'taxClassID', the value of
the master product is returned.
---
### template
- template: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the rendering template name of the product variant.
If the variant does not define an own value for 'template', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'template', the value of
the master product is returned.
---
### thumbnail
- thumbnail: [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)`
- : Returns the thumbnail image of the product variant.
If the variant does not define an own value for 'thumbnail', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'thumbnail', the value of
the master product is returned.
---
### unit
- unit: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the sales unit of the product variant as defined by the
master product.
If the variant does not define an own value for 'unit', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'unit', the value of
the master product is returned.
---
### unitQuantity
- unitQuantity: [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md) `(read-only)`
- : Returns the unitQuantity of the product variant as defined by the
master product.
If the variant does not define an own value for 'unitQuantity', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'unitQuantity', the value of
the master product is returned.
---
## Method Details
### getAllProductLinks()
- getAllProductLinks(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all product links of the product variant.
If the variant does not define any product links, the product links are retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define any product links, the product links are
retrieved from the master product.
**Returns:**
- All product links of the variant, variation group or master
---
### getAllProductLinks(Number)
- getAllProductLinks(type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all product links of the specified type of the product variant.
If the variant does not define any product links of the specified type,
the product links are retrieved for the specified type from the assigned
variation groups, sorted by their position.
If none of the variation groups define any product links of the specified type,
the product links are retrieved for the specified type from the master product.
**Parameters:**
- type - Type of the product link
**Returns:**
- Product links of specified type of the variant, variation group or master
---
### getBrand()
- getBrand(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the brand of the product variant.
If the variant does not define an own value for 'brand', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'brand', the value of
the master product is returned.
**Returns:**
- The brand of the variant, variation group or master
---
### getClassificationCategory()
- getClassificationCategory(): [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md)
- : Returns the classification category of the product variant.
**Please note** that the classification category is always inherited
from the master and cannot be overridden by the variant.
**Returns:**
- The classification category as defined for the master product of the variant
---
### getCustom()
- getCustom(): [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md)
- : Returns the custom attributes of the variant.
Custom attributes are inherited from the master product and can
be overridden by the variant.
**Returns:**
- the custom attributes of the variant.
---
### getEAN()
- getEAN(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the EAN of the product variant.
If the variant does not define an own value for 'EAN', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'EAN', the value of
the master product is returned.
**Returns:**
- The EAN of the variant, variation group or master
---
### getImage()
- getImage(): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md)
- : Returns the image of the product variant.
If the variant does not define an own value for 'image', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'image', the value of
the master product is returned.
**Returns:**
- The image of the variant, variation group or master
---
### getLongDescription()
- getLongDescription(): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md)
- : Returns the long description of the product variant.
If the variant does not define an own value for 'longDescription', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'longDescription', the value of
the master product is returned.
**Returns:**
- The long description of the variant, variation group or master
---
### getManufacturerName()
- getManufacturerName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the manufacturer name of the product variant.
If the variant does not define an own value for 'manufacturerName', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'manufacturerName', the value of
the master product is returned.
**Returns:**
- The manufacturer name of the variant, variation group or master
---
### getManufacturerSKU()
- getManufacturerSKU(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the manufacturer sku of the product variant.
If the variant does not define an own value for 'manufacturerSKU', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'manufacturerSKU', the value of
the master product is returned.
**Returns:**
- The manufacturer sku of the variant, variation group or master
---
### getMasterProduct()
- getMasterProduct(): [Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md)
- : Returns the ProductMaster for this mastered product.
**Returns:**
- the ProductMaster of this mastered product
---
### getName()
- getName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the name of the product variant.
If the variant does not define an own value for 'name', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'name', the value of
the master product is returned.
**Returns:**
- The name of the variant, variation group or master
---
### getOnlineFrom()
- getOnlineFrom(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Returns the onlineFrom date of the product variant.
If the variant does not define an own value for 'onlineFrom', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'onlineFrom', the value of
the master product is returned.
**Returns:**
- The onlineFrom date of the variant, variation group or master
---
### getOnlineTo()
- getOnlineTo(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Returns the onlineTo date of the product variant.
If the variant does not define an own value for 'onlineTo', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'onlineTo', the value of
the master product is returned.
**Returns:**
- The onlineTo date of the variant, variation group or master
---
### getPageDescription()
- getPageDescription(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the pageDescription of the product variant.
If the variant does not define an own value for 'pageDescription', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'pageDescription', the value of
the master product is returned.
**Returns:**
- The pageDescription of the variant, variation group or master
---
### getPageKeywords()
- getPageKeywords(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the pageKeywords of the product variant.
If the variant does not define an own value for 'pageKeywords', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'pageKeywords', the value of
the master product is returned.
**Returns:**
- The pageKeywords of the variant, variation group or master
---
### getPageTitle()
- getPageTitle(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the pageTitle of the product variant.
If the variant does not define an own value for 'pageTitle', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'pageTitle', the value of
the master product is returned.
**Returns:**
- The pageTitle of the variant, variation group or master
---
### getPageURL()
- getPageURL(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the pageURL of the product variant.
If the variant does not define an own value for 'pageURL', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'pageURL', the value of
the master product is returned.
**Returns:**
- The pageURL of the variant, variation group or master
---
### getProductLinks()
- getProductLinks(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all product links of the product variant for which the target
product is assigned to the current site catalog.
If the variant does not define any product links, the product links are retrieved
from the assigned variation groups, sorted by their position
If none of the variation groups define any product links, the product links are retrieved
from the master product.
**Returns:**
- Product links of the variant, variation group or master
---
### getProductLinks(Number)
- getProductLinks(type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all product links of the specified type of the product variant
for which the target product is assigned to the current site catalog.
If the variant does not define any product links of the specified type,
the product links are retrieved for the specified type from the assigned
variation groups, sorted by their position
If none of the variation groups define any product links of the specified type,
the product links are retrieved for the specified type from the master product.
**Parameters:**
- type - Type of the product link
**Returns:**
- Product links of specified type of the variant, variation group or master
---
### getRecommendations(Number)
- getRecommendations(type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Retrieve the sorted collection of recommendations of the specified type
for this product variant. The types (cross-sell, up-sell, etc) are
enumerated in the `dw.catalog.Recommendation` class. Only
recommendations which are stored in the current site catalog are returned.
Furthermore, a recommendation is only returned if the target of the
recommendation is assigned to the current site catalog.
If the variant does not define any recommendations, recommendations are
retrieved from the assigned variation groups, sorted by their position.
If none of the variation groups define any recommendations, the recommendations
of the master are returned.
**Parameters:**
- type - the recommendation type
**Returns:**
- the sorted collection, never null but possibly empty.
---
### getShortDescription()
- getShortDescription(): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md)
- : Returns the short description of the product variant.
If the variant does not define an own value for 'shortDescription', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'shortDescription', the value of
the master product is returned.
**Returns:**
- The short description of the variant, variation group or master
---
### getTaxClassID()
- getTaxClassID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the tax class id of the product variant.
If the variant does not define an own value for 'taxClassID', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'taxClassID', the value of
the master product is returned.
**Returns:**
- The tax class id of the variant, variation group or master
---
### getTemplate()
- getTemplate(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the rendering template name of the product variant.
If the variant does not define an own value for 'template', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'template', the value of
the master product is returned.
**Returns:**
- The rendering template name of the variant, variation group or master
---
### getThumbnail()
- getThumbnail(): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md)
- : Returns the thumbnail image of the product variant.
If the variant does not define an own value for 'thumbnail', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'thumbnail', the value of
the master product is returned.
**Returns:**
- The thumbnail image of the variant, variation group or master
---
### getUPC()
- getUPC(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the UPC of the product variant.
If the variant does not define an own value for 'UPC', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'UPC', the value of
the master product is returned.
**Returns:**
- The UPC of the variant, variation group or master
---
### getUnit()
- getUnit(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the sales unit of the product variant as defined by the
master product.
If the variant does not define an own value for 'unit', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'unit', the value of
the master product is returned.
**Returns:**
- The sales unit of the variant, variation group or master
---
### getUnitQuantity()
- getUnitQuantity(): [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md)
- : Returns the unitQuantity of the product variant as defined by the
master product.
If the variant does not define an own value for 'unitQuantity', the value is retrieved
from the assigned variation groups, sorted by their position.
If none of the variation groups define a value for 'unitQuantity', the value of
the master product is returned.
**Returns:**
- The unitQuantity of the variant, variation group or master
---
### isOptionProduct()
- isOptionProduct(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns 'true' if the variant has any options, otherwise 'false'.
Method also returns 'true' if the variant has not any options,
but the related variation groups (sorted by position) or
master product has options.
**Returns:**
- true if the variant has any options, false otherwise.
---
# Class VariationGroup
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.object.PersistentObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
- [dw.object.ExtensibleObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md)
- [dw.catalog.Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md)
- [dw.catalog.VariationGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md)
Class representing a group of variants within a master product who share a
common value for one or more variation attribute values. Variation groups are
used to simplify merchandising of products.
From a more technical perspective, variation groups are defined by two things:
- A relation to a master product.
- A set of variation attributes which have fixed values.
A variant of the related master product is considered in the group if and
only if it matches on the fixed variation attribute values.
Similar to a Variant, a VariationGroup does a fallback to the master product
for all attributes (name, description, etc) and relations (recommendations,
etc).
## Property Summary
| Property | Description |
| --- | --- |
| [EAN](#ean): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the EAN of the product variation group. |
| [UPC](#upc): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the UPC of the product variation group. |
| [allProductLinks](#allproductlinks): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns all product links of the product variation group. |
| [brand](#brand): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the brand of the product variation group. |
| [classificationCategory](#classificationcategory): [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) `(read-only)` | Returns the classification category of the product variation group. |
| [custom](#custom): [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md) `(read-only)` | Returns the custom attributes of the variation group. |
| [image](#image): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)` | Returns the image of the product variation group. |
| [longDescription](#longdescription): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)` | Returns the long description of the product variation group. |
| [manufacturerName](#manufacturername): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the manufacturer name of the product variation group. |
| [manufacturerSKU](#manufacturersku): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the manufacturer sku of the product variation group. |
| [masterProduct](#masterproduct): [Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md) `(read-only)` | Returns the ProductMaster for this mastered product. |
| [name](#name): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the name of the product variation group. |
| [onlineFrom](#onlinefrom): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)` | Returns the onlineFrom date of the product variation group. |
| [onlineTo](#onlineto): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)` | Returns the onlineTo date of the product variation group. |
| [optionProduct](#optionproduct): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Returns 'true' if the variation group has any options, otherwise 'false'. |
| [pageDescription](#pagedescription): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the pageDescription of the product variation group. |
| [pageKeywords](#pagekeywords): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the pageKeywords of the product variation group. |
| [pageTitle](#pagetitle): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the pageTitle of the product variation group. |
| [pageURL](#pageurl): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the pageURL of the product variation group. |
| [productLinks](#productlinks): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns all product links of the product variation group for which the target product is assigned to the current site catalog. |
| [shortDescription](#shortdescription): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)` | Returns the short description of the product variation group. |
| [taxClassID](#taxclassid): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the tax class id of the product variation group. |
| [template](#template): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the rendering template name of the product variation group. |
| [thumbnail](#thumbnail): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)` | Returns the thumbnail image of the product variation group. |
| [unit](#unit): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the sales unit of the product variation group as defined by the master product. |
| [unitQuantity](#unitquantity): [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md) `(read-only)` | Returns the unitQuantity of the product variation group as defined by the master product. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getAllProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getallproductlinks)() | Returns all product links of the product variation group. |
| [getAllProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getallproductlinksnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns all product links of the specified type of the product variation group. |
| [getBrand](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getbrand)() | Returns the brand of the product variation group. |
| [getClassificationCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getclassificationcategory)() | Returns the classification category of the product variation group. |
| [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getcustom)() | Returns the custom attributes of the variation group. |
| [getEAN](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getean)() | Returns the EAN of the product variation group. |
| [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getimage)() | Returns the image of the product variation group. |
| [getLongDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getlongdescription)() | Returns the long description of the product variation group. |
| [getManufacturerName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getmanufacturername)() | Returns the manufacturer name of the product variation group. |
| [getManufacturerSKU](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getmanufacturersku)() | Returns the manufacturer sku of the product variation group. |
| [getMasterProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getmasterproduct)() | Returns the ProductMaster for this mastered product. |
| [getName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getname)() | Returns the name of the product variation group. |
| [getOnlineFrom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getonlinefrom)() | Returns the onlineFrom date of the product variation group. |
| [getOnlineTo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getonlineto)() | Returns the onlineTo date of the product variation group. |
| [getPageDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getpagedescription)() | Returns the pageDescription of the product variation group. |
| [getPageKeywords](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getpagekeywords)() | Returns the pageKeywords of the product variation group. |
| [getPageTitle](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getpagetitle)() | Returns the pageTitle of the product variation group. |
| [getPageURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getpageurl)() | Returns the pageURL of the product variation group. |
| [getProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getproductlinks)() | Returns all product links of the product variation group for which the target product is assigned to the current site catalog. |
| [getProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getproductlinksnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns all product links of the specified type of the product variation group for which the target product is assigned to the current site catalog. |
| [getRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getrecommendationsnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Retrieve the sorted collection of recommendations of the specified type for this product variation group. |
| [getShortDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getshortdescription)() | Returns the short description of the product variation group. |
| [getTaxClassID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#gettaxclassid)() | Returns the tax class id of the product variation group. |
| [getTemplate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#gettemplate)() | Returns the rendering template name of the product variation group. |
| [getThumbnail](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getthumbnail)() | Returns the thumbnail image of the product variation group. |
| [getUPC](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getupc)() | Returns the UPC of the product variation group. |
| [getUnit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getunit)() | Returns the sales unit of the product variation group as defined by the master product. |
| [getUnitQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#getunitquantity)() | Returns the unitQuantity of the product variation group as defined by the master product. |
| [isOptionProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.VariationGroup.md#isoptionproduct)() | Returns 'true' if the variation group has any options, otherwise 'false'. |
### Methods inherited from class Product
[assignedToCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#assignedtocategorycategory), [getActiveData](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getactivedata), [getAllCategories](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallcategories), [getAllCategoryAssignments](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallcategoryassignments), [getAllIncomingProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallincomingproductlinks), [getAllIncomingProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallincomingproductlinksnumber), [getAllProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallproductlinks), [getAllProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallproductlinksnumber), [getAllRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallrecommendationscatalog), [getAllRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getallrecommendationscatalog-number), [getAttributeModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getattributemodel), [getAvailabilityModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getavailabilitymodel), [getAvailabilityModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getavailabilitymodelproductinventorylist), [getAvailableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getavailableflag), [getBrand](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getbrand), [getBundledProductQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getbundledproductquantityproduct), [getBundledProducts](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getbundledproducts), [getBundles](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getbundles), [getCategories](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getcategories), [getCategoryAssignment](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getcategoryassignmentcategory), [getCategoryAssignments](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getcategoryassignments), [getClassificationCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getclassificationcategory), [getEAN](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getean), [getID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getid), [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getimage), [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getimagestring), [getImage](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getimagestring-number), [getImages](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getimagesstring), [getIncomingProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getincomingproductlinks), [getIncomingProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getincomingproductlinksnumber), [getLongDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getlongdescription), [getManufacturerName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getmanufacturername), [getManufacturerSKU](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getmanufacturersku), [getMinOrderQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getminorderquantity), [getName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getname), [getOnlineCategories](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getonlinecategories), [getOnlineFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getonlineflag), [getOnlineFrom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getonlinefrom), [getOnlineTo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getonlineto), [getOptionModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getoptionmodel), [getOrderableRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getorderablerecommendations), [getOrderableRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getorderablerecommendationsnumber), [getPageDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagedescription), [getPageKeywords](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagekeywords), [getPageMetaTag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagemetatagstring), [getPageMetaTags](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagemetatags), [getPageTitle](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpagetitle), [getPageURL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpageurl), [getPriceModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpricemodel), [getPriceModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getpricemodelproductoptionmodel), [getPrimaryCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getprimarycategory), [getPrimaryCategoryAssignment](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getprimarycategoryassignment), [getProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getproductlinks), [getProductLinks](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getproductlinksnumber), [getProductSetProducts](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getproductsetproducts), [getProductSets](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getproductsets), [getRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getrecommendations), [getRecommendations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getrecommendationsnumber), [getSearchPlacement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsearchplacement), [getSearchRank](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsearchrank), [getSearchableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsearchableflag), [getSearchableIfUnavailableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsearchableifunavailableflag), [getShortDescription](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getshortdescription), [getSiteMapChangeFrequency](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsitemapchangefrequency), [getSiteMapIncluded](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsitemapincluded), [getSiteMapPriority](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getsitemappriority), [getStepQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getstepquantity), [getStoreReceiptName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getstorereceiptname), [getStoreTaxClass](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getstoretaxclass), [getTaxClassID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#gettaxclassid), [getTemplate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#gettemplate), [getThumbnail](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getthumbnail), [getUPC](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getupc), [getUnit](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getunit), [getUnitQuantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getunitquantity), [getVariants](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getvariants), [getVariationGroups](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getvariationgroups), [getVariationModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#getvariationmodel), [includedInBundle](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#includedinbundleproduct), [isAssignedToCategory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isassignedtocategorycategory), [isAssignedToSiteCatalog](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isassignedtositecatalog), [isAvailable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isavailable), [isBundle](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isbundle), [isBundled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isbundled), [isCategorized](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#iscategorized), [isFacebookEnabled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isfacebookenabled), [isMaster](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#ismaster), [isOnline](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isonline), [isOptionProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isoptionproduct), [isPinterestEnabled](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#ispinterestenabled), [isProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isproduct), [isProductSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isproductset), [isProductSetProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isproductsetproduct), [isRetailSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isretailset), [isSearchable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#issearchable), [isSiteProduct](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#issiteproduct), [isVariant](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isvariant), [isVariationGroup](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#isvariationgroup), [setAvailableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setavailableflagboolean), [setOnlineFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setonlineflagboolean---variant-1), [setOnlineFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setonlineflagboolean---variant-2), [setSearchPlacement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchplacementnumber---variant-1), [setSearchPlacement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchplacementnumber---variant-2), [setSearchRank](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchranknumber---variant-1), [setSearchRank](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchranknumber---variant-2), [setSearchableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchableflagboolean---variant-1), [setSearchableFlag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md#setsearchableflagboolean---variant-2)
### Methods inherited from class ExtensibleObject
[describe](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#describe), [getCustom](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#getcustom)
### Methods inherited from class PersistentObject
[getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### EAN
- EAN: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the EAN of the product variation group.
If the variation group does not define an own value for 'EAN', the value of
the master product is returned.
---
### UPC
- UPC: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the UPC of the product variation group.
If the variation group does not define an own value for 'UPC', the value of
the master product is returned.
---
### allProductLinks
- allProductLinks: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns all product links of the product variation group.
If the variation group does not define any product links, but the master product
does, the product links of the master are returned.
---
### brand
- brand: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the brand of the product variation group.
If the variation group does not define an own value for 'brand', the value of
the master product is returned.
---
### classificationCategory
- classificationCategory: [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md) `(read-only)`
- : Returns the classification category of the product variation group.
**Please note** that the classification category is always inherited
from the master and cannot be overridden by the variation group.
---
### custom
- custom: [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md) `(read-only)`
- : Returns the custom attributes of the variation group.
Custom attributes are inherited from the master product and can
be overridden by the variation group.
---
### image
- image: [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)`
- : Returns the image of the product variation group.
If the variation group does not define an own value for 'image', the value of
the master product is returned.
---
### longDescription
- longDescription: [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`
- : Returns the long description of the product variation group.
If the variation group does not define an own value for 'longDescription', the value of
the master product is returned.
---
### manufacturerName
- manufacturerName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the manufacturer name of the product variation group.
If the variation group does not define an own value for 'manufacturerName', the value of
the master product is returned.
---
### manufacturerSKU
- manufacturerSKU: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the manufacturer sku of the product variation group.
If the variation group does not define an own value for 'manufacturerSKU', the value of
the master product is returned.
---
### masterProduct
- masterProduct: [Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md) `(read-only)`
- : Returns the ProductMaster for this mastered product.
---
### name
- name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the name of the product variation group.
If the variation group does not define an own value for 'name', the value of
the master product is returned.
---
### onlineFrom
- onlineFrom: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)`
- : Returns the onlineFrom date of the product variation group.
If the variation group does not define an own value for 'onlineFrom', the value of
the master product is returned.
---
### onlineTo
- onlineTo: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)`
- : Returns the onlineTo date of the product variation group.
If the variation group does not define an own value for 'onlineTo', the value of
the master product is returned.
---
### optionProduct
- optionProduct: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Returns 'true' if the variation group has any options, otherwise 'false'.
Method also returns 'true' if the variation group has not any options,
but the related master product has options.
---
### pageDescription
- pageDescription: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the pageDescription of the product variation group.
If the variation group does not define an own value for 'pageDescription', the value of
the master product is returned.
---
### pageKeywords
- pageKeywords: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the pageKeywords of the product variation group.
If the variation group does not define an own value for 'pageKeywords', the value of
the master product is returned.
---
### pageTitle
- pageTitle: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the pageTitle of the product variation group.
If the variation group does not define an own value for 'pageTitle', the value of
the master product is returned.
---
### pageURL
- pageURL: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the pageURL of the product variation group.
If the variation group does not define an own value for 'pageURL', the value of
the master product is returned.
---
### productLinks
- productLinks: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns all product links of the product variation group for which the target
product is assigned to the current site catalog.
If the variation group does not define any product links, but the master product
does, the product links of the master are returned.
---
### shortDescription
- shortDescription: [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`
- : Returns the short description of the product variation group.
If the variation group does not define an own value for 'shortDescription', the value of
the master product is returned.
---
### taxClassID
- taxClassID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the tax class id of the product variation group.
If the variation group does not define an own value for 'taxClassID', the value of
the master product is returned.
---
### template
- template: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the rendering template name of the product variation group.
If the variation group does not define an own value for 'template', the value of
the master product is returned.
---
### thumbnail
- thumbnail: [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)`
- : Returns the thumbnail image of the product variation group.
If the variation group does not define an own value for 'thumbnailImage', the value of
the master product is returned.
---
### unit
- unit: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the sales unit of the product variation group as defined by the
master product.
If the variation group does not define an own value for 'unit', the value of
the master product is returned.
---
### unitQuantity
- unitQuantity: [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md) `(read-only)`
- : Returns the unitQuantity of the product variation group as defined by the
master product.
If the variation group does not define an own value for 'unitQuantity', the value of
the master product is returned.
---
## Method Details
### getAllProductLinks()
- getAllProductLinks(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all product links of the product variation group.
If the variation group does not define any product links, but the master product
does, the product links of the master are returned.
**Returns:**
- All product links of the variation group or master
---
### getAllProductLinks(Number)
- getAllProductLinks(type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all product links of the specified type of the product variation group.
If the variation group does not define any product links, but the master product
does, the product links of the master are returned.
**Parameters:**
- type - Type of the product link
**Returns:**
- Product links of specified type of the variation group or master
---
### getBrand()
- getBrand(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the brand of the product variation group.
If the variation group does not define an own value for 'brand', the value of
the master product is returned.
**Returns:**
- The brand of the variation group or master
---
### getClassificationCategory()
- getClassificationCategory(): [Category](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Category.md)
- : Returns the classification category of the product variation group.
**Please note** that the classification category is always inherited
from the master and cannot be overridden by the variation group.
**Returns:**
- The classification category as defined for the master product of the variation group
---
### getCustom()
- getCustom(): [CustomAttributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.CustomAttributes.md)
- : Returns the custom attributes of the variation group.
Custom attributes are inherited from the master product and can
be overridden by the variation group.
**Returns:**
- the custom attributes of the variation group.
---
### getEAN()
- getEAN(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the EAN of the product variation group.
If the variation group does not define an own value for 'EAN', the value of
the master product is returned.
**Returns:**
- The EAN of the variation group or master
---
### getImage()
- getImage(): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md)
- : Returns the image of the product variation group.
If the variation group does not define an own value for 'image', the value of
the master product is returned.
**Returns:**
- The image of the variation group or master
---
### getLongDescription()
- getLongDescription(): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md)
- : Returns the long description of the product variation group.
If the variation group does not define an own value for 'longDescription', the value of
the master product is returned.
**Returns:**
- The long description name of the variation group or master
---
### getManufacturerName()
- getManufacturerName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the manufacturer name of the product variation group.
If the variation group does not define an own value for 'manufacturerName', the value of
the master product is returned.
**Returns:**
- The manufacturer name of the variation group or master
---
### getManufacturerSKU()
- getManufacturerSKU(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the manufacturer sku of the product variation group.
If the variation group does not define an own value for 'manufacturerSKU', the value of
the master product is returned.
**Returns:**
- The manufacturer sku of the variation group or master
---
### getMasterProduct()
- getMasterProduct(): [Product](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.Product.md)
- : Returns the ProductMaster for this mastered product.
**Returns:**
- the ProductMaster of this mastered product
---
### getName()
- getName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the name of the product variation group.
If the variation group does not define an own value for 'name', the value of
the master product is returned.
**Returns:**
- The name of the variation group or master
---
### getOnlineFrom()
- getOnlineFrom(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Returns the onlineFrom date of the product variation group.
If the variation group does not define an own value for 'onlineFrom', the value of
the master product is returned.
**Returns:**
- The onlineFrom date of the variation group or master
---
### getOnlineTo()
- getOnlineTo(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Returns the onlineTo date of the product variation group.
If the variation group does not define an own value for 'onlineTo', the value of
the master product is returned.
**Returns:**
- The onlineTo date of the variation group or master
---
### getPageDescription()
- getPageDescription(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the pageDescription of the product variation group.
If the variation group does not define an own value for 'pageDescription', the value of
the master product is returned.
**Returns:**
- The pageDescription of the variation group or master
---
### getPageKeywords()
- getPageKeywords(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the pageKeywords of the product variation group.
If the variation group does not define an own value for 'pageKeywords', the value of
the master product is returned.
**Returns:**
- The pageKeywords of the variation group or master
---
### getPageTitle()
- getPageTitle(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the pageTitle of the product variation group.
If the variation group does not define an own value for 'pageTitle', the value of
the master product is returned.
**Returns:**
- The pageTitle of the variation group or master
---
### getPageURL()
- getPageURL(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the pageURL of the product variation group.
If the variation group does not define an own value for 'pageURL', the value of
the master product is returned.
**Returns:**
- The pageURL of the variation group or master
---
### getProductLinks()
- getProductLinks(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all product links of the product variation group for which the target
product is assigned to the current site catalog.
If the variation group does not define any product links, but the master product
does, the product links of the master are returned.
**Returns:**
- Product links of the variation group or master
---
### getProductLinks(Number)
- getProductLinks(type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns all product links of the specified type of the product variation group
for which the target product is assigned to the current site catalog.
If the variation group does not define any product links of the specified type,
but the master product does, the product links of the master are returned.
**Parameters:**
- type - Type of the product link
**Returns:**
- Product links of specified type of the variation group or master
---
### getRecommendations(Number)
- getRecommendations(type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Retrieve the sorted collection of recommendations of the specified type
for this product variation group. The types (cross-sell, up-sell, etc) are
enumerated in the `dw.catalog.Recommendation` class. Only
recommendations which are stored in the current site catalog are returned.
Furthermore, a recommendation is only returned if the target of the
recommendation is assigned to the current site catalog.
If the variation group does not define any recommendations, but the master
product does, the recommendations of the master are returned.
**Parameters:**
- type - the recommendation type
**Returns:**
- the sorted collection, never null but possibly empty.
---
### getShortDescription()
- getShortDescription(): [MarkupText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md)
- : Returns the short description of the product variation group.
If the variation group does not define an own value for 'shortDescription', the value of
the master product is returned.
**Returns:**
- The short description name of the variation group or master
---
### getTaxClassID()
- getTaxClassID(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the tax class id of the product variation group.
If the variation group does not define an own value for 'taxClassID', the value of
the master product is returned.
**Returns:**
- The tax class id of the variation group or master
---
### getTemplate()
- getTemplate(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the rendering template name of the product variation group.
If the variation group does not define an own value for 'template', the value of
the master product is returned.
**Returns:**
- The rendering template name of the variation group or master
---
### getThumbnail()
- getThumbnail(): [MediaFile](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md)
- : Returns the thumbnail image of the product variation group.
If the variation group does not define an own value for 'thumbnailImage', the value of
the master product is returned.
**Returns:**
- The thumbnail image of the variation group or master
---
### getUPC()
- getUPC(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the UPC of the product variation group.
If the variation group does not define an own value for 'UPC', the value of
the master product is returned.
**Returns:**
- The UPC of the variation group or master
---
### getUnit()
- getUnit(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the sales unit of the product variation group as defined by the
master product.
If the variation group does not define an own value for 'unit', the value of
the master product is returned.
**Returns:**
- The sales unit of the variation group or master
---
### getUnitQuantity()
- getUnitQuantity(): [Quantity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.value.Quantity.md)
- : Returns the unitQuantity of the product variation group as defined by the
master product.
If the variation group does not define an own value for 'unitQuantity', the value of
the master product is returned.
**Returns:**
- The unitQuantity of the variation group or master
---
### isOptionProduct()
- isOptionProduct(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns 'true' if the variation group has any options, otherwise 'false'.
Method also returns 'true' if the variation group has not any options,
but the related master product has options.
**Returns:**
- true if the variation group has any options, false otherwise.
---
# Class Velocity
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.template.Velocity](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.template.Velocity.md)
This class renders an Apache Velocity template. For Velocity template syntax, see
[Velocity 1.7](https://velocity.apache.org/engine/releases/velocity-1.7/).
The render() methods identify the template to render from:
- a template file name, which is resolved in the Dynamic WebDAV file location for the current site. Template file names must end with either '.vm' or '.vs'.
- a dw.io.File object, which can point to any file system location that is accessible from a script
- a string that holds the template content directly
**Note:** Files included from an ISML template (either via `#parse` or `#include`) are always resolved
in the Dynamic location, and it is not possible to provide an absolute path.
On the target side of rendering, by default the render() methods write to the current response writer. When needed,
a `dw.io.Writer` can be supplied as a target.
Parameters for rendering can be passed as a single object holding the parameters as properties.
To create a URL, pass the `URLUtils` class.
To access localized strings, pass the `Resource` class:
```
var urlUtil = require('dw/web/URLUtils');
velocity.render("$url.abs('Foo-Bar','cgid',$res.msg('key')", {'url' : urlUtil, 'res' : dw.web.Resource});
```
The complete set of [VelocityTools](https://velocity.apache.org/tools/releases/2.0/generic.html)
are provided to the template. You can use the tools to escape dynamic data, format text, and for other common tasks.
Template files are cached for different amounts of time, depending on the instance type.
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| static [remoteInclude](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.template.Velocity.md#remoteincludestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Includes the rendered content of the specified action URL, which usually is a pipeline or controller. |
| static [render](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.template.Velocity.md#renderstring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Renders an inline template to the response writer. |
| static [render](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.template.Velocity.md#renderstring-object-writer)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)) | Renders an inline template to the provided writer. |
| static [renderTemplate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.template.Velocity.md#rendertemplatefile-object)([File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Renders a template file to the response writer. |
| static [renderTemplate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.template.Velocity.md#rendertemplatefile-object-writer)([File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)) | Renders a template file to the provided writer. |
| static [renderTemplate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.template.Velocity.md#rendertemplatestring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Renders a template file to the response writer. |
| static [renderTemplate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.template.Velocity.md#rendertemplatestring-object-writer)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)) | Renders a template file to the provided writer. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Method Details
### remoteInclude(String, String...)
- static remoteInclude(action: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namesAndParams: [String...](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Includes the rendered content of the specified action URL, which usually is a pipeline or controller. Must only be used inside a Velocity
template, such as `$velocity.remoteInclude('Product-Show','sku','42')`
**Parameters:**
- action - the URL (pipeline or controller) to be included
- namesAndParams - several strings with name=value pairs , e.g.: 'pid', 'value1', 'cgid', value2'.
**Returns:**
- the string that needs to be added to the Velocity template to execute the remote include
---
### render(String, Object)
- static render(templateContent: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Renders an inline template to the response writer.
**Parameters:**
- templateContent - the template content
- args - the argument object
---
### render(String, Object, Writer)
- static render(templateContent: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), writer: [Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)): void
- : Renders an inline template to the provided writer.
**Parameters:**
- templateContent - the template content
- args - the argument object
- writer - the target writer
---
### renderTemplate(File, Object)
- static renderTemplate(templateFile: [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), args: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Renders a template file to the response writer.
**Parameters:**
- templateFile - the file object denoting the template
- args - the argument object
---
### renderTemplate(File, Object, Writer)
- static renderTemplate(templateFile: [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), args: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), writer: [Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)): void
- : Renders a template file to the provided writer.
**Parameters:**
- templateFile - the file object denoting the template
- args - the argument object
- writer - the target writer
---
### renderTemplate(String, Object)
- static renderTemplate(templateFileName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Renders a template file to the response writer.
**Parameters:**
- templateFileName - the file name of the template, relative to the current sites Dynamic file location. For example, for a file at a location similar to:
```
https://mydomain.com/on/demandware.servlet/webdav/Sites/Dynamic/SiteGenesis/myfile.vm
```
render the file in this way:
```
velocity.renderTemplate("myfile.vm", null);
```
- args - the argument object
---
### renderTemplate(String, Object, Writer)
- static renderTemplate(templateFileName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), args: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), writer: [Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)): void
- : Renders a template file to the provided writer.
**Parameters:**
- templateFileName - the file name of the template, relative to the current sites Dynamic file location. For example, for a file at a location similar to:
```
https://mydomain.com/on/demandware.servlet/webdav/Sites/Dynamic/SiteGenesis/mydir/myfile.vm
```
render the file in this way:
```
velocity.renderTemplate("mydir/myfile.vm", null, result);
```
- args - the argument object to pass to the template
- writer - the target writer
---
# Class Wallet
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.customer.Wallet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md)
Represents a set of payment instruments associated with a registered customer.
**Note:** this class allows access to sensitive personal and private
information. Pay attention to appropriate legal and regulatory requirements
when developing.
## Property Summary
| Property | Description |
| --- | --- |
| [defaultPaymentInstrument](#defaultpaymentinstrument): [CustomerPaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md) `(read-only)` | Returns the default payment instrument associated with the related customer. |
| [paymentInstruments](#paymentinstruments): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns a collection of all payment instruments associated with the related customer. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [createPaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#createpaymentinstrumentstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a new, empty payment instrument object associated with the related customer for the given payment method. |
| [getDefaultPaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#getdefaultpaymentinstrument)() | Returns the default payment instrument associated with the related customer. |
| [getPaymentInstruments](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#getpaymentinstruments)() | Returns a collection of all payment instruments associated with the related customer. |
| [getPaymentInstruments](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#getpaymentinstrumentsstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a collection of all payment instruments associated with the related customer filtered by the given payment method id. |
| [removePaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#removepaymentinstrumentcustomerpaymentinstrument)([CustomerPaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md)) | Removes a payment instrument associated with the customer. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### defaultPaymentInstrument
- defaultPaymentInstrument: [CustomerPaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md) `(read-only)`
- : Returns the default payment instrument associated with the related customer. If not available, returns the first
payment instrument or null if no payment instruments are associated with the customer.
---
### paymentInstruments
- paymentInstruments: [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
- : Returns a collection of all payment instruments associated with the
related customer.
---
## Method Details
### createPaymentInstrument(String)
- createPaymentInstrument(paymentMethodId: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [CustomerPaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md)
- : Creates a new, empty payment instrument object associated with the
related customer for the given payment method.
**Parameters:**
- paymentMethodId - the id of a payment method
**Returns:**
- the new payment instrument object.
**Throws:**
- NullArgumentException - If passed 'paymentMethodId' is null.
---
### getDefaultPaymentInstrument()
- getDefaultPaymentInstrument(): [CustomerPaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md)
- : Returns the default payment instrument associated with the related customer. If not available, returns the first
payment instrument or null if no payment instruments are associated with the customer.
**Returns:**
- The default payment instrument object.
---
### getPaymentInstruments()
- getPaymentInstruments(): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns a collection of all payment instruments associated with the
related customer.
**Returns:**
- Collection of all payment instruments.
---
### getPaymentInstruments(String)
- getPaymentInstruments(paymentMethodID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Collection](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
- : Returns a collection of all payment instruments associated with the
related customer filtered by the given payment method id. If
`null` is passed as payment method id all payment instruments
of the customer will be retrieved. If for the given payment method id no
payment instrument is associated with the customer an empty collection
will be returned.
**Parameters:**
- paymentMethodID - the paymentMethodID the payment method id to filter for
**Returns:**
- Collection of payment instruments for a payment method.
---
### removePaymentInstrument(CustomerPaymentInstrument)
- removePaymentInstrument(instrument: [CustomerPaymentInstrument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md)): void
- : Removes a payment instrument associated with the customer.
**Parameters:**
- instrument - the instrument associated with this customer
**Throws:**
- NullArgumentException - If passed 'instrument' is null.
- IllegalArgumentException - If passed 'instrument' belongs to an other customer
---
# Class WeakCipher
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.crypto.WeakCipher](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md)
This API provides access to Deprecated algorithms.
See [Cipher](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md) for full documentation. WeakCipher is simply a drop-in replacement that **only** supports
deprecated algorithms and key lengths. This is helpful when you need to deal with weak algorithms for backward
compatibility purposes, but Cipher should always be used for new development and for anything intended to be secure.
**Note:** this class handles sensitive security-related data. Pay special attention to PCI DSS v3 requirements 2,
4, and 12.
## Constant Summary
| Constant | Description |
| --- | --- |
| [CHAR_ENCODING](#char_encoding): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "UTF8" | Strings containing keys, plain texts, cipher texts etc. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WeakCipher](#weakcipher)() | |
## Method Summary
| Method | Description |
| --- | --- |
| [decryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-keyref-string-string-number---variant-1)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-1), which allows to use a key in the keystore for the decryption. |
| [decryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-1)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Lower-level decryption API. |
| [decryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-keyref-string-string-number---variant-2)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-2), which allows to use a key in the keystore for the decryption. |
| [decryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-2)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Lower-level decryption API. |
| [decryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-keyref-string-string-number---variant-3)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-3), which allows to use a key in the keystore for the decryption. |
| [decryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-3)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Lower-level decryption API. |
| [decrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-keyref-string-string-number---variant-1)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-1), which allows using a key in the keystore for the decryption. |
| [decrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-1)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Decrypts the message using the given parameters. |
| [decrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-keyref-string-string-number---variant-2)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-2), which allows using a key in the keystore for the decryption. |
| [decrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-2)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Decrypts the message using the given parameters. |
| [decrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-keyref-string-string-number---variant-3)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-3), which allows using a key in the keystore for the decryption. |
| [decrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-3)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Decrypts the message using the given parameters. |
| [encryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-certificateref-string-string-number---variant-1)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-1), which allows to use a key in the keystore for the encryption. |
| [encryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-1)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Lower-level encryption API. |
| [encryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-certificateref-string-string-number---variant-2)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-2), which allows to use a key in the keystore for the encryption. |
| [encryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-2)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Lower-level encryption API. |
| [encryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-certificateref-string-string-number---variant-3)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Alternative method to [encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-3), which allows to use a key in the keystore for the encryption. |
| [encryptBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-3)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Lower-level encryption API. |
| [encrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-certificateref-string-string-number---variant-1)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. |
| [encrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-string-string-string-number---variant-1)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. |
| [encrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-certificateref-string-string-number---variant-2)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. |
| [encrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-string-string-string-number---variant-2)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. |
| [encrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-certificateref-string-string-number---variant-3)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. |
| [encrypt](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-string-string-string-number---variant-3)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### CHAR_ENCODING
- CHAR_ENCODING: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "UTF8"
- : Strings containing keys, plain texts, cipher texts etc. are internally
converted into byte arrays using this encoding (currently UTF8).
---
## Constructor Details
### WeakCipher()
- WeakCipher()
- :
---
## Method Details
### decryptBytes(Bytes, KeyRef, String, String, Number) - Variant 1
- decryptBytes(encryptedBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Alternative method to [decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-1), which allows to use a key in
the keystore for the decryption. See [Cipher.decryptBytes(Bytes, KeyRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptbytesbytes-keyref-string-string-number---variant-1) for full
documentation.
**Parameters:**
- encryptedBytes - The bytes to decrypt.
- privateKey - A reference to a private key in the key store.
- transformation - The transformation used to originally encrypt.
- saltOrIV - the salt or IV to use.
- iterations - the iterations to use.
**Returns:**
- The decrypted bytes.
**API Version:**
**note:** No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
---
### decryptBytes(Bytes, String, String, String, Number) - Variant 1
- decryptBytes(encryptedBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Lower-level decryption API. Decrypts the passed bytes using the specified
key and applying the transformations described by the specified
parameters. See [Cipher.decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptbytesbytes-string-string-string-number---variant-1) for full
documentation.
**Parameters:**
- encryptedBytes - The bytes to decrypt.
- key - The key to use for decryption.
- transformation - The transformation used to originally encrypt.
- saltOrIV - the salt or IV to use.
- iterations - the iterations to use.
**Returns:**
- The decrypted bytes.
**See Also:**
- [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-1)
**API Version:**
**note:** No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
---
### decryptBytes(Bytes, KeyRef, String, String, Number) - Variant 2
- decryptBytes(encryptedBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Alternative method to [decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-2), which allows to use a key in
the keystore for the decryption. See [Cipher.decryptBytes(Bytes, KeyRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptbytesbytes-keyref-string-string-number---variant-2) for full
documentation.
**Parameters:**
- encryptedBytes - The bytes to decrypt.
- privateKey - A reference to a private key in the key store.
- transformation - The transformation used to originally encrypt.
- saltOrIV - the salt or IV to use.
- iterations - the iterations to use.
**Returns:**
- The decrypted bytes.
**API Version:**
**note:** Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
---
### decryptBytes(Bytes, String, String, String, Number) - Variant 2
- decryptBytes(encryptedBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Lower-level decryption API. Decrypts the passed bytes using the specified
key and applying the transformations described by the specified
parameters. See [Cipher.decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptbytesbytes-string-string-string-number---variant-2) for full
documentation.
**Parameters:**
- encryptedBytes - The bytes to decrypt.
- key - The key to use for decryption.
- transformation - The transformation used to originally encrypt.
- saltOrIV - the salt or IV to use.
- iterations - the iterations to use.
**Returns:**
- The decrypted bytes.
**See Also:**
- [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-2)
**API Version:**
**note:** Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
---
### decryptBytes(Bytes, KeyRef, String, String, Number) - Variant 3
- decryptBytes(encryptedBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Alternative method to [decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptbytesbytes-string-string-string-number---variant-3), which allows to use a key in
the keystore for the decryption. See [Cipher.decryptBytes(Bytes, KeyRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptbytesbytes-keyref-string-string-number---variant-3) for full
documentation.
**Parameters:**
- encryptedBytes - The bytes to decrypt.
- privateKey - A reference to a private key in the key store.
- transformation - The transformation used to originally encrypt.
- saltOrIV - the salt or IV to use.
- iterations - the iterations to use.
**Returns:**
- The decrypted bytes.
**API Version:**
**note:** Available from version 16.2.
Does not use a default initialization vector.
---
### decryptBytes(Bytes, String, String, String, Number) - Variant 3
- decryptBytes(encryptedBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Lower-level decryption API. Decrypts the passed bytes using the specified
key and applying the transformations described by the specified
parameters. See [Cipher.decryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptbytesbytes-string-string-string-number---variant-3) for full
documentation.
**Parameters:**
- encryptedBytes - The bytes to decrypt.
- key - The key to use for decryption.
- transformation - The transformation used to originally encrypt.
- saltOrIV - the salt or IV to use.
- iterations - the iterations to use.
**Returns:**
- The decrypted bytes.
**See Also:**
- [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-3)
**API Version:**
**note:** Available from version 16.2.
Does not use a default initialization vector.
---
### decrypt(String, KeyRef, String, String, Number) - Variant 1
- decrypt(base64Msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Alternative method to [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-1), which allows using a key in the
keystore for the decryption. See [Cipher.decrypt(String, KeyRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptstring-keyref-string-string-number---variant-1) for full
documentation.
**Parameters:**
- base64Msg - the base64 encoded data to decrypt
- privateKey - A reference to a private key in the key store.
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- the original plaintext message.
**API Version:**
**note:** No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
---
### decrypt(String, String, String, String, Number) - Variant 1
- decrypt(base64Msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Decrypts the message using the given parameters. See
[Cipher.decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptstring-string-string-string-number---variant-1) for full documentation.
**Parameters:**
- base64Msg - the base64 encoded data to decrypt
- key - The decryption key
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- the original plaintext message.
**API Version:**
**note:** No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
---
### decrypt(String, KeyRef, String, String, Number) - Variant 2
- decrypt(base64Msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Alternative method to [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-2), which allows using a key in the
keystore for the decryption. See [Cipher.decrypt(String, KeyRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptstring-keyref-string-string-number---variant-2) for full
documentation.
**Parameters:**
- base64Msg - the base64 encoded data to decrypt
- privateKey - A reference to a private key in the key store.
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- the original plaintext message.
**API Version:**
**note:** Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
---
### decrypt(String, String, String, String, Number) - Variant 2
- decrypt(base64Msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Decrypts the message using the given parameters. See
[Cipher.decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptstring-string-string-string-number---variant-2) for full documentation.
**Parameters:**
- base64Msg - the base64 encoded data to decrypt
- key - The decryption key
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- the original plaintext message.
**API Version:**
**note:** Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
---
### decrypt(String, KeyRef, String, String, Number) - Variant 3
- decrypt(base64Msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Alternative method to [decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#decryptstring-string-string-string-number---variant-3), which allows using a key in the
keystore for the decryption. See [Cipher.decrypt(String, KeyRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptstring-keyref-string-string-number---variant-3) for full
documentation.
**Parameters:**
- base64Msg - the base64 encoded data to decrypt
- privateKey - A reference to a private key in the key store.
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- the original plaintext message.
**API Version:**
**note:** Available from version 16.2.
Does not use a default initialization vector.
---
### decrypt(String, String, String, String, Number) - Variant 3
- decrypt(base64Msg: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Decrypts the message using the given parameters. See
[Cipher.decrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#decryptstring-string-string-string-number---variant-3) for full documentation.
**Parameters:**
- base64Msg - the base64 encoded data to decrypt
- key - The decryption key
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- the original plaintext message.
**API Version:**
**note:** Available from version 16.2.
Does not use a default initialization vector.
---
### encryptBytes(Bytes, CertificateRef, String, String, Number) - Variant 1
- encryptBytes(messageBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), publicKey: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Alternative method to [encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-1), which allows
to use a key in the keystore for the encryption. See [Cipher.encryptBytes(Bytes, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptbytesbytes-certificateref-string-string-number---variant-1) for full documentation.
**Parameters:**
- messageBytes - The bytes to encrypt.
- publicKey - A reference to a public key
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key.
**Returns:**
- the encrypted bytes.
**See Also:**
- [encrypt(String, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-certificateref-string-string-number---variant-1)
**API Version:**
**note:** No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
---
### encryptBytes(Bytes, String, String, String, Number) - Variant 1
- encryptBytes(messageBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Lower-level encryption API. Encrypts the passed bytes by using the specified key and applying the transformations
described by the specified parameters. See [Cipher.encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptbytesbytes-string-string-string-number---variant-1)
for full documentation.
**Parameters:**
- messageBytes - The bytes to encrypt.
- key - The key to use for encryption.
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key.
**Returns:**
- the encrypted bytes.
**See Also:**
- [encrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-string-string-string-number---variant-1)
**API Version:**
**note:** No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
---
### encryptBytes(Bytes, CertificateRef, String, String, Number) - Variant 2
- encryptBytes(messageBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), publicKey: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Alternative method to [encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-2), which allows
to use a key in the keystore for the encryption. See [Cipher.encryptBytes(Bytes, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptbytesbytes-certificateref-string-string-number---variant-2) for full documentation.
**Parameters:**
- messageBytes - The bytes to encrypt.
- publicKey - A reference to a public key.
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key.
**Returns:**
- the encrypted bytes.
**See Also:**
- [encrypt(String, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-certificateref-string-string-number---variant-2)
**API Version:**
**note:** Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
---
### encryptBytes(Bytes, String, String, String, Number) - Variant 2
- encryptBytes(messageBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Lower-level encryption API. Encrypts the passed bytes by using the specified key and applying the transformations
described by the specified parameters. See [Cipher.encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptbytesbytes-string-string-string-number---variant-2)
for full documentation.
**Parameters:**
- messageBytes - The bytes to encrypt.
- key - The key to use for encryption.
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key.
**Returns:**
- the encrypted bytes.
**See Also:**
- [encrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-string-string-string-number---variant-2)
**API Version:**
**note:** Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
---
### encryptBytes(Bytes, CertificateRef, String, String, Number) - Variant 3
- encryptBytes(messageBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), publicKey: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Alternative method to [encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptbytesbytes-string-string-string-number---variant-3), which allows
to use a key in the keystore for the encryption. See [Cipher.encryptBytes(Bytes, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptbytesbytes-certificateref-string-string-number---variant-3) for full documentation.
**Parameters:**
- messageBytes - The bytes to encrypt.
- publicKey - A reference to a public key.
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key.
**Returns:**
- the encrypted bytes.
**See Also:**
- [encrypt(String, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-certificateref-string-string-number---variant-3)
**API Version:**
**note:** Available from version 16.2.
Does not use a default initialization vector.
---
### encryptBytes(Bytes, String, String, String, Number) - Variant 3
- encryptBytes(messageBytes: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Lower-level encryption API. Encrypts the passed bytes by using the specified key and applying the transformations
described by the specified parameters. See [Cipher.encryptBytes(Bytes, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptbytesbytes-string-string-string-number---variant-3)
for full documentation.
**Parameters:**
- messageBytes - The bytes to encrypt.
- key - The key to use for encryption.
- transformation - Transformation in _"algorithm/mode/padding"_ format.
- saltOrIV - Initialization value appropriate for the algorithm.
- iterations - The number of passes to make when turning a passphrase into a key.
**Returns:**
- the encrypted bytes.
**See Also:**
- [encrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakCipher.md#encryptstring-string-string-string-number---variant-3)
**API Version:**
**note:** Available from version 16.2.
Does not use a default initialization vector.
---
### encrypt(String, CertificateRef, String, String, Number) - Variant 1
- encrypt(message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), publicKey: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See [Cipher.encrypt(String, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptstring-certificateref-string-string-number---variant-1) for full documentation.
**Parameters:**
- message - Message to encrypt (this will be converted to UTF-8 first)
- publicKey - A reference to a public key
- transformation - Transformation in _"algorithm/mode/padding"_ format
- saltOrIV - Initialization value appropriate for the algorithm
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- Base64-encoded encrypted data
**API Version:**
**note:** No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
---
### encrypt(String, String, String, String, Number) - Variant 1
- encrypt(message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See [Cipher.encrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptstring-string-string-string-number---variant-1) for full documentation.
**Parameters:**
- message - Message to encrypt (this will be converted to UTF-8 first)
- key - Key
- transformation - Transformation in _"algorithm/mode/padding"_ format
- saltOrIV - Initialization value appropriate for the algorithm
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- Base64-encoded encrypted data
**API Version:**
**note:** No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
---
### encrypt(String, CertificateRef, String, String, Number) - Variant 2
- encrypt(message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), publicKey: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See [Cipher.encrypt(String, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptstring-certificateref-string-string-number---variant-2) for full documentation.
**Parameters:**
- message - Message to encrypt (this will be converted to UTF-8 first)
- publicKey - A reference to a public key
- transformation - Transformation in _"algorithm/mode/padding"_ format
- saltOrIV - Initialization value appropriate for the algorithm
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- Base64-encoded encrypted data
**API Version:**
**note:** Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
---
### encrypt(String, String, String, String, Number) - Variant 2
- encrypt(message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See [Cipher.encrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptstring-string-string-string-number---variant-2) for full documentation.
**Parameters:**
- message - Message to encrypt (this will be converted to UTF-8 first)
- key - Key
- transformation - Transformation in _"algorithm/mode/padding"_ format
- saltOrIV - Initialization value appropriate for the algorithm
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- Base64-encoded encrypted data
**API Version:**
**note:** Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
---
### encrypt(String, CertificateRef, String, String, Number) - Variant 3
- encrypt(message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), publicKey: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See [Cipher.encrypt(String, CertificateRef, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptstring-certificateref-string-string-number---variant-3) for full documentation.
**Parameters:**
- message - Message to encrypt (this will be converted to UTF-8 first)
- publicKey - A reference to a public key
- transformation - Transformation in _"algorithm/mode/padding"_ format
- saltOrIV - Initialization value appropriate for the algorithm
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- Base64-encoded encrypted data
**API Version:**
**note:** Available from version 16.2.
Does not use a default initialization vector.
---
### encrypt(String, String, String, String, Number) - Variant 3
- encrypt(message: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), transformation: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), saltOrIV: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), iterations: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See [Cipher.encrypt(String, String, String, String, Number)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Cipher.md#encryptstring-string-string-string-number---variant-3) for full documentation.
**Parameters:**
- message - Message to encrypt (this will be converted to UTF-8 first)
- key - Key
- transformation - Transformation in _"algorithm/mode/padding"_ format
- saltOrIV - Initialization value appropriate for the algorithm
- iterations - The number of passes to make when turning a passphrase into a key, if applicable
**Returns:**
- Base64-encoded encrypted data
**API Version:**
**note:** Available from version 16.2.
Does not use a default initialization vector.
---
# Class WeakMac
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.crypto.WeakMac](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMac.md)
This API provides access to Deprecated algorithms.
See [Mac](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Mac.md) for full documentation. WeakMac is simply a drop-in replacement that **only** supports
deprecated algorithms. This is helpful when you need to deal with weak algorithms for backward
compatibility purposes, but Mac should always be used for new development and for anything intended to be secure.
This class provides the functionality of a "Message Authentication Code" (MAC) algorithm.
A MAC provides a way to check the integrity of information transmitted over or
stored in an unreliable medium, based on a secret key.
Typically, message authentication codes are used between two parties
that share a secret key in order to validate information transmitted between these parties.
A MAC mechanism that is based on cryptographic hash functions is referred to as HMAC.
HMAC can be used with any cryptographic hash function, e.g., SHA256,
in combination with a secret shared key. HMAC is specified in RFC 2104.
**Note:** this class handles sensitive security-related data.
Pay special attention to PCI DSS v3. requirements 2, 4, and 12.
## Constant Summary
| Constant | Description |
| --- | --- |
| [HMAC_MD5](#hmac_md5): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "HmacMD5" | Constant representing the HMAC-MD5 keyed-hashing algorithm as defined in RFC 2104 "HMAC: Keyed-Hashing for Message Authentication" (February 1997). |
| [HMAC_SHA_1](#hmac_sha_1): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "HmacSHA1" | Constant representing the HmacSHA1 algorithms as defined in RFC 2104 "HMAC: Keyed-Hashing for Message Authentication" (February 1997) with SHA-1 as the message digest algorithm. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WeakMac](#weakmacstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Construct a Mac encryption instance with the specified algorithm name. |
## Method Summary
| Method | Description |
| --- | --- |
| [digest](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMac.md#digestbytes-bytes)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)) | Computes the hash value for the passed bytes input using the passed secret key. |
| [digest](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMac.md#digeststring-bytes)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)) | Computes the hash value for the passed string input using the passed secret key. |
| [digest](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMac.md#digeststring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Computes the hash value for the passed string input using the passed secret key. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### HMAC_MD5
- HMAC_MD5: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "HmacMD5"
- : Constant representing the HMAC-MD5 keyed-hashing algorithm as defined in RFC 2104 "HMAC: Keyed-Hashing for Message Authentication" (February 1997).
This algorithm uses as MD5 cryptographic hash function.
This algorithm is obsolete. Do not use it for any sensitive data
---
### HMAC_SHA_1
- HMAC_SHA_1: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "HmacSHA1"
- : Constant representing the HmacSHA1 algorithms as defined in RFC 2104 "HMAC: Keyed-Hashing for Message Authentication" (February 1997)
with SHA-1 as the message digest algorithm.
This algorithm is obsolete. Do not use it for any sensitive data
---
## Constructor Details
### WeakMac(String)
- WeakMac(algorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Construct a Mac encryption instance with the specified algorithm name. The
supported algorithms are:
- HmacMD5
- HmacSHA1
**Parameters:**
- algorithm - the standard name of the digest algorithm, must not be null.
**Throws:**
- NullArgumentException - if algorithm is null.
- IllegalArgumentException - if the specified algorithm name is not supported.
---
## Method Details
### digest(Bytes, Bytes)
- digest(input: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), key: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Computes the hash value for the passed bytes input using the passed secret key.
**Parameters:**
- input - The bytes to calculate a RFC 2104 compliant HMAC hash value.
- key - The secret key as byte array ready for use with the algorithm. The key's format depends on the chosen algorithm and the keys are assumed to be correctly formulated for the algorithm used, for example that the lengths are correct. Keys are _not_ checked for validity. Only such keys that have no key parameters associated with them.
**Returns:**
- The resulting hash value as bytes.
**Throws:**
- IllegalArgumentException - if algorithm is not null and the specified algorithm name is not supported.
---
### digest(String, Bytes)
- digest(input: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), key: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Computes the hash value for the passed string input using the passed secret key.
Given input will be first converted with UTF-8 encoding into a byte array.
The resulting hash is typically converted with base64 back into a string.
**Parameters:**
- input - A string to calculate a RFC 2104 compliant HMAC hash value for.
- key - The secret key as bytes ready for use with the algorithm. The key's format depends on the chosen algorithm and the keys are assumed to be correctly formulated for the algorithm used, for example that the lengths are correct. Keys are _not_ checked for validity. Only such keys that have no key parameters associated with them.
**Returns:**
- The resulting hash value as bytes.
**Throws:**
- IllegalArgumentException - if algorithm is not null and the specified algorithm name is not supported.
---
### digest(String, String)
- digest(input: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Computes the hash value for the passed string input using the passed secret key.
Given input and the given key will be first converted with UTF-8 encoding into a byte array.
The resulting hash is typically converted with base64 back into a string.
**Parameters:**
- input - A string to calculate a RFC 2104 compliant HMAC hash value for.
- key - The secret key ready for use with the algorithm. The key's format depends on the chosen algorithm and the keys are assumed to be correctly formulated for the algorithm used, for example that the lengths are correct. Keys are _not_ checked for validity. Only such keys that have no key parameters associated with them.
**Returns:**
- The resulting hash value as bytes.
**Throws:**
- IllegalArgumentException - if algorithm is not null and the specified algorithm name is not supported.
---
# Class WeakMap
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.WeakMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakMap.md)
The WeakMap is map whose entries are subject to garbage collection if there are no more references to the keys.
Keys must be objects (no primitives). Elements can't be iterated.
**API Version:**
**note:** Available from version 21.2.
## Property Summary
| Property | Description |
| --- | --- |
| [size](#size): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | Number of key/value pairs stored in this map. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WeakMap](#weakmap)() | Creates an empty map. |
| [WeakMap](#weakmapiterable)([Iterable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Iterable.md)) | If the passed value is null or undefined then an empty map is constructed. |
## Method Summary
| Method | Description |
| --- | --- |
| [clear](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakMap.md#clear)() | Removes all key/value pairs from this map. |
| [delete](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakMap.md#deleteobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Removes the entry for the given key. |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakMap.md#getobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns the value associated with the given key. |
| [has](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakMap.md#hasobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns if this map has value associated with the given key. |
| [set](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakMap.md#setobject-object)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Adds or updates a key/value pair to the map. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### size
- size: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Number of key/value pairs stored in this map.
---
## Constructor Details
### WeakMap()
- WeakMap()
- : Creates an empty map.
---
### WeakMap(Iterable)
- WeakMap(values: [Iterable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Iterable.md))
- : If the passed value is null or undefined then an empty map is constructed. Else an iterator object is expected
that produces a two-element array-like object whose first element is a value that will be used as a Map key and
whose second element is the value to associate with that key.
**Parameters:**
- values - The initial map values
---
## Method Details
### clear()
- clear(): void
- : Removes all key/value pairs from this map.
---
### delete(Object)
- delete(key: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Removes the entry for the given key.
**Parameters:**
- key - The key of the key/value pair to be removed from the map.
**Returns:**
- `true` if the map contained an entry for the passed key that was removed. Else `false` is returned.
---
### get(Object)
- get(key: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the value associated with the given key.
**Parameters:**
- key - The key to look for.
**Returns:**
- The value associated with the given key if an entry with the key exists else `undefined` is returned.
---
### has(Object)
- has(key: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns if this map has value associated with the given key.
**Parameters:**
- key - The key to look for.
**Returns:**
- `true` if an entry with the key exists else `false` is returned.
---
### set(Object, Object)
- set(key: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [WeakMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakMap.md)
- : Adds or updates a key/value pair to the map.
**Parameters:**
- key - The key object.
- value - The value to be associate with the key.
**Returns:**
- This map object.
---
# Class WeakMessageDigest
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.crypto.WeakMessageDigest](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMessageDigest.md)
This API provides access to Deprecated algorithms.
See [MessageDigest](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.MessageDigest.md) for full documentation. WeakMessageDigest is simply a drop-in replacement that **only** supports
deprecated algorithms. This is helpful when you need to deal with weak algorithms for backward
compatibility purposes, but MessageDigest should always be used for new development and for anything intended to be secure.
**Note:** this class handles sensitive security-related data.
Pay special attention to PCI DSS v3. requirements 2, 4, and 12.
## Constant Summary
| Constant | Description |
| --- | --- |
| [DIGEST_MD2](#digest_md2): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "MD2" | Constant representing the MD2 algorithm. |
| [DIGEST_MD5](#digest_md5): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "MD5" | Constant representing the MD5 algorithm. |
| [DIGEST_SHA](#digest_sha): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "SHA" | Constant representing the SHA algorithm. |
| [DIGEST_SHA_1](#digest_sha_1): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "SHA-1" | Constant representing the SHA 1 algorithm. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WeakMessageDigest](#weakmessagedigeststring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Construct a MessageDigest with the specified algorithm name. |
## Method Summary
| Method | Description |
| --- | --- |
| [digest](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMessageDigest.md#digest)() | Completes the hash computation by performing final operations such as padding. |
| ~~[digest](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMessageDigest.md#digeststring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Digests the passed string and returns a computed hash value as a string. |
| ~~[digest](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMessageDigest.md#digeststring-bytes)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md))~~ | Computes the hash value for the passed array of bytes. |
| [digestBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMessageDigest.md#digestbytesbytes)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)) | Computes the hash value for the passed [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md). |
| [updateBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakMessageDigest.md#updatebytesbytes)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)) | Updates the digest using the passed [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md). |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### DIGEST_MD2
- DIGEST_MD2: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "MD2"
- : Constant representing the MD2 algorithm.
This algorithm is obsolete. Do not use it for any sensitive data
---
### DIGEST_MD5
- DIGEST_MD5: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "MD5"
- : Constant representing the MD5 algorithm.
This algorithm is obsolete. Do not use it for any sensitive data
---
### DIGEST_SHA
- DIGEST_SHA: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "SHA"
- : Constant representing the SHA algorithm.
This algorithm is obsolete. Do not use it for any sensitive data
---
### DIGEST_SHA_1
- DIGEST_SHA_1: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "SHA-1"
- : Constant representing the SHA 1 algorithm.
This algorithm is obsolete. Do not use it for any sensitive data
---
## Constructor Details
### WeakMessageDigest(String)
- WeakMessageDigest(algorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Construct a MessageDigest with the specified algorithm name.
**Parameters:**
- algorithm - The standard name of the digest algorithm, must not be null and must be a supported algorithm.
---
## Method Details
### digest()
- digest(): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Completes the hash computation by performing final operations such as
padding.
The binary representation of the message is typically derived from a
string and the resulting hash is typically converted with base64 back
into a string. Example:
`
Encoding.toBase64( digest() );
`
**Returns:**
- The resulting hash value.
---
### digest(String)
- ~~digest(input: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Digests the passed string and returns a computed hash value as a string.
The passed String is first encoded into a sequence of bytes using the
platform's default encoding. The digest then performs any prerequisite
padding, before computing the hash value. The hash is then converted into
a string by converting all digits to hexadecimal.
**Parameters:**
- input - The value to hash as String, must not be null.
**Returns:**
- The resulting hash value as hex-encoded string.
**Deprecated:**
**warning:** Deprecated because the conversion of the input to bytes using
the default platform encoding and the hex-encoded return
value are not generally appropriate.
---
### digest(String, Bytes)
- ~~digest(algorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), input: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)~~
- : Computes the hash value for the passed array of bytes. The algorithm
argument is optional. If null, then the algorithm established at
construction time is used.
The binary representation of the message is typically derived from a
string and the resulting hash is typically converted with base64 back
into a string. Example:
`
Encoding.toBase64( digest( "MD5", new Bytes( "my password", "UTF-8" ) ) );
`
**Parameters:**
- algorithm - The standard name of the digest algorithm, or null if the algorithm passed at construction time is to be used. The algorithm must be a supported algorithm.
- input - The value to hash, must not be null.
**Returns:**
- The resulting hash value.
**Deprecated:**
**warning:** Deprecated because the digest algorithm should be the one
set in the constructor.
---
### digestBytes(Bytes)
- digestBytes(input: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Computes the hash value for the passed [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md).
The binary representation of the message is typically derived from a
string and the resulting hash is typically converted with base64 back
into a string. Example:
`
Encoding.toBase64( digest( new Bytes( "my password", "UTF-8" ) ) );
`
**Parameters:**
- input - The value to hash, must not be null.
**Returns:**
- The resulting hash value.
---
### updateBytes(Bytes)
- updateBytes(input: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)): void
- : Updates the digest using the passed [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md).
**Parameters:**
- input - The value to hash, must not be null.
---
# Class WeakSet
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.WeakSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakSet.md)
The WeakSet is set whose elements are subject to garbage collection if there are no more references to the elements.
Only objects (no primitives) can be stored. Elements can't be iterated.
**API Version:**
**note:** Available from version 21.2.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WeakSet](#weakset)() | Creates an empty Set. |
| [WeakSet](#weaksetiterable)([Iterable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Iterable.md)) | If the passed value is null or undefined then an empty set is constructed. |
## Method Summary
| Method | Description |
| --- | --- |
| [add](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakSet.md#addobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Adds an element to the set. |
| [delete](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakSet.md#deleteobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Removes the element from the set. |
| [has](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakSet.md#hasobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns if this set contains the given object. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### WeakSet()
- WeakSet()
- : Creates an empty Set.
---
### WeakSet(Iterable)
- WeakSet(values: [Iterable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Iterable.md))
- : If the passed value is null or undefined then an empty set is constructed. Else an iterable object is expected
that delivers the initial set entries.
**Parameters:**
- values - The initial set entries.
---
## Method Details
### add(Object)
- add(object: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [WeakSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.WeakSet.md)
- : Adds an element to the set. Does nothing if the set already contains the element.
**Parameters:**
- object - The object to add.
**Returns:**
- This set object.
---
### delete(Object)
- delete(object: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Removes the element from the set.
**Parameters:**
- object - The object to be removed.
**Returns:**
- `true` if the set contained the object that was removed. Else `false` is returned.
---
### has(Object)
- has(object: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns if this set contains the given object.
**Parameters:**
- object - The object to look for.
**Returns:**
- `true` if the set contains the object else `false` is returned.
---
# Class WeakSignature
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.crypto.WeakSignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md)
This API provides access to Deprecated algorithms.
See [Signature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.Signature.md) for full documentation. WeakSignature is simply a drop-in replacement that **only** supports
deprecated algorithms. This is helpful when you need to deal with weak algorithms for backward compatibility
purposes, but Signature should always be used for new development and for anything intended to be secure.
This class allows access to signature services offered through the Java Cryptography Architecture (JCA). At this time
the signature/verification implementation of the methods is based on the default RSA JCE provider of the JDK -
sun.security.rsa.SunRsaSign
dw.crypto.WeakSignature is an adapter to the security provider implementation and only covers one digest algorithm:
- SHA1withRSA
**Note:** this class handles sensitive security-related data. Pay special attention to PCI DSS v3. requirements 2,
4, 12, and other relevant requirements.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WeakSignature](#weaksignature)() | |
## Method Summary
| Method | Description |
| --- | --- |
| [isDigestAlgorithmSupported](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#isdigestalgorithmsupportedstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Checks to see if a digest algorithm is supported |
| [sign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#signstring-keyref-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Signs a string and returns a string |
| [sign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#signstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Signs a string and returns a string |
| [signBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#signbytesbytes-keyref-string)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Signs bytes and returns bytes |
| [signBytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#signbytesbytes-string-string)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Signs bytes and returns bytes |
| [verifyBytesSignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#verifybytessignaturebytes-bytes-certificateref-string)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Verifies a signature supplied as bytes |
| [verifyBytesSignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#verifybytessignaturebytes-bytes-string-string)([Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Verifies a signature supplied as bytes |
| [verifySignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#verifysignaturestring-string-certificateref-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Verifies a signature supplied as string |
| [verifySignature](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.WeakSignature.md#verifysignaturestring-string-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Verifies a signature supplied as string |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### WeakSignature()
- WeakSignature()
- :
---
## Method Details
### isDigestAlgorithmSupported(String)
- isDigestAlgorithmSupported(digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Checks to see if a digest algorithm is supported
**Parameters:**
- digestAlgorithm - the digest algorithm name
**Returns:**
- a boolean indicating success (true) or failure (false)
---
### sign(String, KeyRef, String)
- sign(contentToSign: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Signs a string and returns a string
**Parameters:**
- contentToSign - base64 encoded content to sign
- privateKey - a reference to a private key entry in the keystore
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- the base64 encoded signature
---
### sign(String, String, String)
- sign(contentToSign: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), privateKey: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Signs a string and returns a string
**Parameters:**
- contentToSign - base64 encoded content to sign
- privateKey - base64 encoded private key
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- the base64 encoded signature
---
### signBytes(Bytes, KeyRef, String)
- signBytes(contentToSign: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), privateKey: [KeyRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.KeyRef.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Signs bytes and returns bytes
**Parameters:**
- contentToSign - transformed with UTF-8 encoding into a byte stream
- privateKey - a reference to a private key entry in the keystore
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- signature
---
### signBytes(Bytes, String, String)
- signBytes(contentToSign: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), privateKey: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md)
- : Signs bytes and returns bytes
**Parameters:**
- contentToSign - transformed with UTF-8 encoding into a byte stream
- privateKey - base64 encoded private key
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- signature
---
### verifyBytesSignature(Bytes, Bytes, CertificateRef, String)
- verifyBytesSignature(signature: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), contentToVerify: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), certificate: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Verifies a signature supplied as bytes
**Parameters:**
- signature - signature to check as bytes
- contentToVerify - as bytes
- certificate - a reference to a trusted certificate
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- a boolean indicating success (true) or failure (false)
---
### verifyBytesSignature(Bytes, Bytes, String, String)
- verifyBytesSignature(signature: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), contentToVerify: [Bytes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Bytes.md), publicKey: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Verifies a signature supplied as bytes
**Parameters:**
- signature - signature to check as bytes
- contentToVerify - as bytes
- publicKey - base64 encoded public key
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- a boolean indicating success (true) or failure (false)
---
### verifySignature(String, String, CertificateRef, String)
- verifySignature(signature: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contentToVerify: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), certificate: [CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Verifies a signature supplied as string
**Parameters:**
- signature - base64 encoded signature
- contentToVerify - base64 encoded content to verify
- certificate - a reference to a trusted certificate
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- a boolean indicating success (true) or failure (false)
---
### verifySignature(String, String, String, String)
- verifySignature(signature: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), contentToVerify: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), publicKey: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), digestAlgorithm: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Verifies a signature supplied as string
**Parameters:**
- signature - base64 encoded signature
- contentToVerify - base64 encoded content to verify
- publicKey - base64 encoded public key
- digestAlgorithm - must be one of the currently supported ones
**Returns:**
- a boolean indicating success (true) or failure (false)
---
# Class WebDAVClient
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.net.WebDAVClient](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md)
The WebDAVClient class supports the WebDAV methods GET, PUT, MKCOL, MOVE,
COPY, PROPFIND,OPTIONS and DELETE.
**Note:** when this class is used with sensitive data, be careful in persisting sensitive information to disk.
The client can be used as shown in the following example:
```
var webdavClient : WebDAVClient = new WebDAVClient("http://mywebdav.server.com","myusername", "mypassword");
var getString : String = webdavClient.get("myData.xml","UTF-8");
var message : String;
if (webdavClient.succeeded())
{
message = webDavClient.statusText;
}
else
{
// error handling
message="An error occurred with status code "+webdavClient.statusCode;
}
var data : XML = new XML(getString);
```
The WebDAV client supports the following authentication schemes:
- Basic authentication
- Digest authentication
The methods of this class do not generally throw exceptions if the underlying
WebDAV operation do not succeed.The result of a WebDAV operation can be
checked using the methods succeeded(), getStatusCode(), and getStatusText().
Important note: This WebDAV client cannot be used to access the Commerce Cloud Digital
server via WebDAV protocol.
## Constant Summary
| Constant | Description |
| --- | --- |
| [DEFAULT_ENCODING](#default_encoding): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "UTF-8" | The default encoding character set. |
| [DEFAULT_GET_FILE_SIZE](#default_get_file_size): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 5242880 | The default size for `get()` returning a File is 5MB. |
| [DEFAULT_GET_STRING_SIZE](#default_get_string_size): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2097152 | The default size for `get()` returning a String is 2MB. |
| [DEPTH_0](#depth_0): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0 | The depth of searching a WebDAV destination using the PROPFIND method - if that depth is given to the PROPFIND method as an input parameter the destination will be searched only on the level of the given path and a list of all containing files on that level will be returned \[is not supported by every server\]. |
| [DEPTH_1](#depth_1): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | The depth of searching a WebDAV destination using the PROPFIND method - if that depth is given to the PROPFIND method as an input parameter the destination will be searched until one level under the given path and a list of all containing files in that two levels \[/path and one level underneath\] will be returned \[is not supported by every server\]. |
| [DEPTH_INIFINITY](#depth_inifinity): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2147483647 | The depth of searching a WebDAV destination using the PROPFIND method - if that depth is given to the PROPFIND method as an input parameter the destination will be fully searched and a list of all containing files will be returned \[is not supported by every server\]. |
| [MAX_GET_FILE_SIZE](#max_get_file_size): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 209715200 | The maximum size for `get()` returning a File is forty times the default size for getting a file. |
| [MAX_GET_STRING_SIZE](#max_get_string_size): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 10485760 | The maximum size for `get()` returning a String is five times the default size for getting a String. |
## Property Summary
| Property | Description |
| --- | --- |
| [allResponseHeaders](#allresponseheaders): [HashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.HashMap.md) `(read-only)` | Returns a [HashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.HashMap.md) of all response headers. |
| [statusCode](#statuscode): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the status code after the execution of a method. |
| [statusText](#statustext): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the status text after the execution of a method. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WebDAVClient](#webdavclientstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a new client for the use at a server which requires authentication. |
| [WebDAVClient](#webdavclientstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a new client for the use at a server which does not require authentication. |
## Method Summary
| Method | Description |
| --- | --- |
| [addRequestHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#addrequestheaderstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Adds a request header to the next WebDAV call. |
| [close](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#close)() | Closes the current connection to the server. |
| [copy](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#copystring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Copies a file on the server from one place `rootUrl`/`origin` to the other `rootUrl`/`destination`. |
| [copy](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#copystring-string-boolean)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)) | Copies a file on the server from one place `rootUrl`/`origin` to the other `rootUrl`/`destination`. |
| [copy](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#copystring-string-boolean-boolean)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)) | Copies a file on the server from one place `rootUrl`/`origin` to the other `rootUrl`/`destination`. |
| [del](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#delstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Deletes a file or directory from the remote server that can be found under `rootUrl`/`path`. |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Reads the content of a remote file or directory that can be found under `rootUrl`/`path` and returns a string representation of the data found in the DEFAULT\_ENCODING encoding. |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getstring-file)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md)) | Reads the content of a remote file or directory that can be found under `rootUrl`/`path` in DEFAULT\_ENCODING encoding and writes a [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md) in the system's standard encoding, which is "UTF-8". |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getstring-file-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Reads the content of a remote file or directory that can be found under `rootUrl`/`path` in DEFAULT\_ENCODING encoding and writes a [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md) in the system's standard encoding, which is "UTF-8". |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getstring-file-string-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Reads the content of a remote file or directory that can be found under `rootUrl`/`path` in the passed encoding and writes a [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md) in the system standard encoding, which is "UTF-8". |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Reads the content of a remote file or directory that can be found under `rootUrl`/`path` and returns a string representation of the data found in the given `encoding`. |
| [get](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getstring-string-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Reads the content of a remote file or directory that can be found under `rootUrl`/`path` and returns a string representation of the data found in the given `encoding`. |
| [getAllResponseHeaders](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getallresponseheaders)() | Returns a [HashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.HashMap.md) of all response headers. |
| [getBinary](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getbinarystring-file)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md)) | Reads the content of a remote binary file that can be found under `rootUrl`/`path` and creates a local copy in [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md). |
| [getBinary](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getbinarystring-file-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Reads the content of a remote binary file that can be found under `rootUrl`/`path` and creates a local copy in [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md). |
| [getResponseHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getresponseheaderstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a specified response header - multiple headers are separated by CRLF. |
| [getStatusCode](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getstatuscode)() | Returns the status code after the execution of a method. |
| [getStatusText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#getstatustext)() | Returns the status text after the execution of a method. |
| [mkcol](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#mkcolstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Creates a directory on the remote server on the location `rootUrl`/`path`. |
| [move](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#movestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Moves a file on the server from one place `rootUrl` + "/" +`origin` to the other `rootUrl`/`destination`. |
| [move](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#movestring-string-boolean)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)) | Moves a file on the server from one place `rootUrl`/`origin` to the other `rootUrl`/`destination` Can also be used to rename a remote file. |
| [options](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#optionsstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a list of methods which can be executed on the server location `rootUrl`/`path`. |
| [propfind](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#propfindstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Get file listing of a remote location. |
| [propfind](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#propfindstring-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Get file listing of a remote location. |
| [put](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#putstring-file)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md)) | Puts content out of a passed local file into a remote located file at `rootUrl`/`path`. |
| [put](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#putstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Puts content encoded with DEFAULT\_ENCODING into a remote located file at `rootUrl`/`path`. |
| [put](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#putstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Puts content encoded with the passed encoding into a remote located file at `rootUrl`/`path`. |
| [succeeded](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#succeeded)() | Returns true if the last executed WebDAV method was executed successfully - otherwise false. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### DEFAULT_ENCODING
- DEFAULT_ENCODING: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "UTF-8"
- : The default encoding character set.
---
### DEFAULT_GET_FILE_SIZE
- DEFAULT_GET_FILE_SIZE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 5242880
- : The default size for `get()` returning a File is 5MB.
---
### DEFAULT_GET_STRING_SIZE
- DEFAULT_GET_STRING_SIZE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2097152
- : The default size for `get()` returning a String is 2MB.
---
### DEPTH_0
- DEPTH_0: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 0
- : The depth of searching a WebDAV destination using the PROPFIND method -
if that depth is given to the PROPFIND method as an input parameter the
destination will be searched only on the level of the given path and a
list of all containing files on that level will be returned \[is not
supported by every server\].
---
### DEPTH_1
- DEPTH_1: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : The depth of searching a WebDAV destination using the PROPFIND method -
if that depth is given to the PROPFIND method as an input parameter the
destination will be searched until one level under the given path and a
list of all containing files in that two levels \[/path and one level
underneath\] will be returned \[is not supported by every server\].
---
### DEPTH_INIFINITY
- DEPTH_INIFINITY: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2147483647
- : The depth of searching a WebDAV destination using the PROPFIND method -
if that depth is given to the PROPFIND method as an input parameter the
destination will be fully searched and a list of all containing files
will be returned \[is not supported by every server\].
---
### MAX_GET_FILE_SIZE
- MAX_GET_FILE_SIZE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 209715200
- : The maximum size for `get()` returning a File is forty times
the default size for getting a file. The largest file allowed is 200MB.
---
### MAX_GET_STRING_SIZE
- MAX_GET_STRING_SIZE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 10485760
- : The maximum size for `get()` returning a String is five
times the default size for getting a String. The largest String allowed
is 10MB.
---
## Property Details
### allResponseHeaders
- allResponseHeaders: [HashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.HashMap.md) `(read-only)`
- : Returns a [HashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.HashMap.md) of all response headers.
---
### statusCode
- statusCode: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the status code after the execution of a method.
---
### statusText
- statusText: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the status text after the execution of a method.
---
## Constructor Details
### WebDAVClient(String, String, String)
- WebDAVClient(rootUrl: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), username: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), password: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Creates a new client for the use at a server which requires
authentication.
The client supports the following authentication schemes:
- Basic authentication scheme
- Digest authentication scheme
**Parameters:**
- rootUrl - the url of the server one wants to connect to. All commands will be executed by the client relative to that url.
- username - username of the user for server authentication.
- password - password of the user for server authentication.
---
### WebDAVClient(String)
- WebDAVClient(rootUrl: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Creates a new client for the use at a server which does not require
authentication.
**Parameters:**
- rootUrl - the url of the server one wants to connect to. All commands will be executed by the client relative to that url.
---
## Method Details
### addRequestHeader(String, String)
- addRequestHeader(headerName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), headerValue: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Adds a request header to the next WebDAV call.
**Parameters:**
- headerName - name of the header.
- headerValue - value of the header.
---
### close()
- close(): void
- : Closes the current connection to the server.
---
### copy(String, String)
- copy(origin: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), destination: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Copies a file on the server from one place `rootUrl`/`origin`
to the other `rootUrl`/`destination`. If
`destination` already exists it gets overwritten. Returns
true if succeeded, otherwise false.
**Parameters:**
- origin - The origin where a file is located, relative to the `rootUrl` stated when instantiating the client.
- destination - The destination where the file should be copied to, relative to the `rootUrl` stated when instantiating the client.
**Returns:**
- true if succeeded, otherwise false.
---
### copy(String, String, Boolean)
- copy(origin: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), destination: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), overwrite: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Copies a file on the server from one place `rootUrl`/`origin`
to the other `rootUrl`/`destination`. If
the passed parameter `overwrite` is true and
`destination` already exists it gets overwritten. Returns
true if succeeded, otherwise false.
**Parameters:**
- origin - The origin where a file is located, relative to the `rootUrl` stated when instantiating the client.
- destination - The destination where the file should be copied to, relative to the `rootUrl` stated when instantiating the client.
- overwrite - A flag which determines whether the destination gets overwritten if it exists before copying.
**Returns:**
- true if succeeded, otherwise false.
---
### copy(String, String, Boolean, Boolean)
- copy(origin: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), destination: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), overwrite: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), shallow: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Copies a file on the server from one place `rootUrl`/`origin`
to the other `rootUrl`/`destination`. If
the passed parameter `overwrite` is true and
`destination` already exists it gets overwritten. If the
passed parameter `shallow` is true a flat copy mechanism is
used.
Returns true if succeeded, otherwise false.
**Parameters:**
- origin - The origin where a file is located, relative to the `rootUrl` stated when instantiating the client.
- destination - The destination where the file should be copied to, relative to the `rootUrl` stated when instantiating the client.
- overwrite - A flag which determines whether the destination gets overwritten if it exits before copying
- shallow - A flag which determines how to copy the given data.
**Returns:**
- true if succeeded, otherwise false.
---
### del(String)
- del(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Deletes a file or directory from the remote server that can be found
under `rootUrl`/`path`. Returns true if
succeeded, otherwise false.
**Parameters:**
- path - The path of the file or collection to delete, relative to the `rootUrl` stated when instantiating the client.
**Returns:**
- true if succeeded, otherwise false.
---
### get(String)
- get(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Reads the content of a remote file or directory that can be found under
`rootUrl`/`path` and returns a string
representation of the data found in the DEFAULT\_ENCODING encoding. If the
remote location is a directory the result depends on the server
configuration, some return an HTML formatted directory listing. Returns
at most DEFAULT\_GET\_STRING\_SIZE bytes.
**Parameters:**
- path - The path of the collection or file one wants to get, relative to the `rootUrl` stated when instantiating the client.
**Returns:**
- returns the String representation of the data found on the given
path.
---
### get(String, File)
- get(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), file: [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Reads the content of a remote file or directory that can be found under
`rootUrl`/`path` in DEFAULT\_ENCODING
encoding and writes a [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md) in the system's standard
encoding, which is "UTF-8". If the remote location is a directory the
result depends on the server configuration, some return an HTML formatted
directory listing. Receives at most DEFAULT\_GET\_FILE\_SIZE bytes which
determines the file size of the local file. Returns true if succeeded
otherwise false.
**Parameters:**
- path - The path of the collection or file one wants to get - relative to the `rootUrl` stated when instantiating the client.
- file - The file to save the received data in.
**Returns:**
- returns true if succeeded, otherwise false.
---
### get(String, File, Number)
- get(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), file: [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), maxFileSize: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Reads the content of a remote file or directory that can be found under
`rootUrl`/`path` in DEFAULT\_ENCODING
encoding and writes a [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md) in the system's standard
encoding, which is "UTF-8". If the remote location is a directory the
result depends on the server configuration, some return an HTML formatted
directory listing. Receives at most maxFileSize bytes which determines
the file size of the local file. Returns true if succeeded, otherwise
false.
**Parameters:**
- path - The path of the collection or file one wants to get - relative to the `rootUrl` stated when instantiating the client.
- file - The file to save the received data in.
- maxFileSize - The maximum size of bytes to stream into the file. Not to exceed MAX\_GET\_FILE\_SIZE.
**Returns:**
- returns true if succeeded, otherwise false.
---
### get(String, File, String, Number)
- get(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), file: [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), encoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), maxFileSize: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Reads the content of a remote file or directory that can be found under
`rootUrl`/`path` in the passed encoding and
writes a [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md) in the system standard encoding, which is
"UTF-8". If the remote location is a directory the result depends on the
server configuration, some return an HTML formatted directory listing.
Receives at most maxFileSize bytes which determines the file size of the
local file. Returns true if succeeded, otherwise false.
**Parameters:**
- path - The path of the collection or file one wants to get - relative to the `rootUrl` stated when instantiating the client.
- file - The file to save the received data in.
- encoding - The encoding to use when reading the remote file.
- maxFileSize - The maximum number of bytes to stream into the file. Not to exceed MAX\_GET\_FILE\_SIZE.
**Returns:**
- returns true if succeeded, otherwise false.
---
### get(String, String)
- get(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), encoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Reads the content of a remote file or directory that can be found under
`rootUrl`/`path` and returns a string
representation of the data found in the given `encoding`. If
the remote location is a directory the result depends on the server
configuration, some return an HTML formatted directory listing. Returns
at most DEFAULT\_GET\_STRING\_SIZE bytes.
**Parameters:**
- path - The path of the collection or file one wants to get - relative to the `rootUrl` stated when instantiating the client.
- encoding - The encoding of the resulting String.
**Returns:**
- returns the String representation of the data found on the given
path in the given encoding.
---
### get(String, String, Number)
- get(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), encoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), maxGetSize: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Reads the content of a remote file or directory that can be found under
`rootUrl`/`path` and returns a string
representation of the data found in the given `encoding`. If
the remote location is a directory the result depends on the server
configuration, some return an HTML formatted directory listing. Returns
at most maxGetSize bytes.
**Parameters:**
- path - The path of the collection or file one wants to get - relative to the `rootUrl` stated when instantiating the client.
- encoding - The encoding of the resulting String.
- maxGetSize - The maximum size of data in bytes. Not to exceed MAX\_GET\_STRING\_SIZE.
**Returns:**
- returns the String representation of the data found on the given
path in the given encoding.
---
### getAllResponseHeaders()
- getAllResponseHeaders(): [HashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.HashMap.md)
- : Returns a [HashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.HashMap.md) of all response headers.
**Returns:**
- all headers in a [HashMap](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.HashMap.md).
---
### getBinary(String, File)
- getBinary(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), file: [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Reads the content of a remote binary file that can be found under
`rootUrl`/`path` and creates a local copy
in [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md). If the remote location is a directory the result
depends on the server configuration, some return an HTML formatted
directory listing. Copies at most DEFAULT\_GET\_FILE\_SIZE bytes. Returns
true if succeeded, otherwise false.
**Parameters:**
- path - The path relative to `rootUrl` on the remote server including the file name.
- file - The local file where the received binary data should be stored.
**Returns:**
- true if succeeded, otherwise false.
---
### getBinary(String, File, Number)
- getBinary(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), file: [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md), maxFileSize: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Reads the content of a remote binary file that can be found under
`rootUrl`/`path` and creates a local copy
in [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md). If the remote location is a directory the result
depends on the server configuration, some return an HTML formatted
directory listing. Copies at most maxFileSize bytes. Returns true if
succeeded, otherwise false.
**Parameters:**
- path - The path relative to `rootUrl` on the remote server including the file name.
- file - The file local file where the received binary data should be stored.
- maxFileSize - The maximum number of bytes to stream into the file. Not to exceed MAX\_GET\_FILE\_SIZE.
**Returns:**
- true if succeeded, otherwise false.
---
### getResponseHeader(String)
- getResponseHeader(header: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a specified response header - multiple headers are separated by
CRLF.
**Parameters:**
- header - The name of the header.
**Returns:**
- The header - in case of multiple headers separated by CRLF.
---
### getStatusCode()
- getStatusCode(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the status code after the execution of a method.
**Returns:**
- the `statusCode`.
---
### getStatusText()
- getStatusText(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the status text after the execution of a method.
**Returns:**
- the `statusText`.
---
### mkcol(String)
- mkcol(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Creates a directory on the remote server on the location
`rootUrl`/`path`.
**Parameters:**
- path - The path relative to the `rootUrl` stated when instantiating the client where the new collection should be created.
**Returns:**
- true if succeeded, otherwise false.
---
### move(String, String)
- move(origin: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), destination: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Moves a file on the server from one place `rootUrl` + "/" +`origin`
to the other `rootUrl`/`destination`. If
`destination` already exists it gets overwritten. Can also
be used to rename a remote file. Returns true if succeeded, otherwise
false.
**Parameters:**
- origin - The origin where a file is located, relative to the `rootUrl` stated when instantiating the client.
- destination - The destination where the file should be moved to, relative to the `rootUrl` stated when instantiating the client.
**Returns:**
- true if succeeded, otherwise false.
---
### move(String, String, Boolean)
- move(origin: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), destination: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), overwrite: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Moves a file on the server from one place `rootUrl`/`origin`
to the other `rootUrl`/`destination` Can
also be used to rename a remote file. If `overwrite` is true
and `destination` already exists it gets overwritten.
Returns true if succeeded, otherwise false.
**Parameters:**
- origin - The origin where a file is located, relative to the `rootUrl` stated when instantiating the client.
- destination - The destination where the file should be moved to, relative to the `rootUrl` stated when instantiating the client.
- overwrite - A flag which determines whether the destination gets overwritten if it exists before moving.
**Returns:**
- true if succeeded, otherwise false.
---
### options(String)
- options(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String\[\]](TopLevel.String.md)
- : Returns a list of methods which can be executed on the server location
`rootUrl`/`path`.
**Parameters:**
- path - The path relative to the `rootUrl` stated when instantiating the client one wants to get the options for.
**Returns:**
- list of WebDav methods which can be executed on the given path.
---
### propfind(String)
- propfind(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [WebDAVFileInfo\[\]](dw.net.WebDAVFileInfo.md)
- : Get file listing of a remote location.
Returns a list of [WebDAVFileInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md) objects which contain
information about the files and directories located on
`rootUrl`/`path` and DEPTH\_1 (1) level
underneath.
**Parameters:**
- path - The path relative to the `rootUrl` stated when instantiating the client where to get information about the containing files from.
**Returns:**
- an Array of [WebDAVFileInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md) objects which hold
information about the files located on the server at the
location.
---
### propfind(String, Number)
- propfind(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), depth: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [WebDAVFileInfo\[\]](dw.net.WebDAVFileInfo.md)
- : Get file listing of a remote location.
Returns a list of [WebDAVFileInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md) objects which contain
information about the files and directories located on
`rootUrl`/`path` and the passed depth
underneath.
**Parameters:**
- path - The path relative to the `rootUrl` stated when instantiating the client where to get information about the containing files from.
- depth - The level starting from `rootUrl` down to which the file information gets collected.
**Returns:**
- an Array of [WebDAVFileInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md) objects which hold
information about the files located on the server at the
location.
---
### put(String, File)
- put(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), file: [File](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.File.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Puts content out of a passed local file into a remote located file
at `rootUrl`/`path`. This method performs
a binary file transfer. Returns true if succeeded, otherwise false.
**Parameters:**
- path - The path to put given content up to, relative to the `rootUrl` stated when instantiating the client.
- file - The file to push up to the server.
**Returns:**
- true if succeeded, otherwise false.
---
### put(String, String)
- put(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), content: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Puts content encoded with DEFAULT\_ENCODING into a remote located file at
`rootUrl`/`path`. Returns true if
succeeded, otherwise false.
If the content of a local file is to be uploaded, please use method
[put(String, File)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#putstring-file) instead.
**Parameters:**
- path - The path to put given content up to, relative to the `rootUrl` stated when instantiating the client.
- content - The content that has to be pushed on to the server.
**Returns:**
- true if succeeded, otherwise false.
---
### put(String, String, String)
- put(path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), content: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), encoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Puts content encoded with the passed encoding into a remote located file
at `rootUrl`/`path`. Returns true if
succeeded, otherwise false.
If the content of a local file is to be uploaded, please use method
[put(String, File)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#putstring-file) instead.
**Parameters:**
- path - The path to put a given content up to, relative to the `rootUrl` stated when instantiating the client.
- content - The content that has to be pushed on to a remote location.
- encoding - The encoding in which the data should be stored on the server.
**Returns:**
- true if succeeded, otherwise false.
---
### succeeded()
- succeeded(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns true if the last executed WebDAV method was executed successfully - otherwise false.
See the code snippet above for an example how to use the succeed() method.
**Returns:**
- true if the last executed WebDAV method was successful - otherwise false.
**See Also:**
- [WebDAVClient](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md)
---
# Class WebDAVFileInfo
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.net.WebDAVFileInfo](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md)
Simple class representing a file on a remote WebDAV location. The class
possesses only read-only attributes of the file and does not permit any
manipulation of the file itself. Instances of this class are returned
by [WebDAVClient.propfind(String)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVClient.md#propfindstring) which is used to get a
listing of files in a WebDAV directory.
**Note:** when this class is used with sensitive data, be careful in persisting sensitive information to disk.
## Property Summary
| Property | Description |
| --- | --- |
| [contentType](#contenttype): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the content type of the file. |
| [creationDate](#creationdate): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)` | Returns the creationDate of the file. |
| [directory](#directory): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Identifies if the file is a directory. |
| [name](#name): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the name of the file. |
| [path](#path): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the path of the file. |
| [size](#size): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the size of the file. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getContentType](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md#getcontenttype)() | Returns the content type of the file. |
| [getCreationDate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md#getcreationdate)() | Returns the creationDate of the file. |
| [getName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md#getname)() | Returns the name of the file. |
| [getPath](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md#getpath)() | Returns the path of the file. |
| [getSize](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md#getsize)() | Returns the size of the file. |
| [isDirectory](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md#isdirectory)() | Identifies if the file is a directory. |
| [lastModified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.net.WebDAVFileInfo.md#lastmodified)() | Returns the lastModified date of the file. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### contentType
- contentType: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the content type of the file.
---
### creationDate
- creationDate: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)`
- : Returns the creationDate of the file.
---
### directory
- directory: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Identifies if the file is a directory.
---
### name
- name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the name of the file.
---
### path
- path: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the path of the file.
---
### size
- size: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the size of the file.
---
## Method Details
### getContentType()
- getContentType(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the content type of the file.
**Returns:**
- the content type of the file.
---
### getCreationDate()
- getCreationDate(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Returns the creationDate of the file.
**Returns:**
- the creationDate of the file.
---
### getName()
- getName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the name of the file.
**Returns:**
- the name of the file.
---
### getPath()
- getPath(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the path of the file.
**Returns:**
- the path of the file.
---
### getSize()
- getSize(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the size of the file.
**Returns:**
- the size of the file.
---
### isDirectory()
- isDirectory(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Identifies if the file is a directory.
**Returns:**
- true if the file is a directory, false otherwise.
---
### lastModified()
- lastModified(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Returns the lastModified date of the file.
**Returns:**
- the lastModified date of the file.
---
# Class WebReference
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.rpc.WebReference](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.WebReference.md)
Represents a web service defined in a WSDL file. The implementation is backed by a JAX-RPC framework.
You should use the newer dw.ws package and [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md) class instead, which is based on JAX-WS.
Use the Services module in Business Manager to set timeout values, not the methods for this class.
The Services module provides better analytics and timeout management.
To create an instance of a WebReference object, in a B2C Commerce Script file, reference a WSDL file in the `webreferences`
directory and request the service [Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md) using one of the get service methods.
For example, if your WSDL file is `MyWSDL.wsdl`,
to create an instance of WebReference and access the [Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md):
```
var webref : WebReference = webreferences.MyWSDL;
var stub : Stub = webref.getDefaultService();
```
**Note:** script classes representing your WSDL file are are generated by the platform and then placed in the `WebReferences`
package. You do not need to include the `importPackage`
statement in your B2C Commerce Script file to use classes in the `WebReferences` package.
**See Also:**
- [Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md)
- [SOAPUtil](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.SOAPUtil.md)
**Deprecated:**
**warning:** This class is deprecated, please use webreferences2 instead (see also [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)).
In migrating from webreferences to webreferences2 the property `collectionType=indexed` may be helpful.
Setting this in the property file for the WSDL will make the generated API more closely resemble the API generated by webreferences.
## Property Summary
| Property | Description |
| --- | --- |
| ~~[defaultService](#defaultservice): [Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md)~~ `(read-only)` | Returns the default service of the WebReference object. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WebReference](#webreference)() | |
## Method Summary
| Method | Description |
| --- | --- |
| ~~[getDefaultService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.WebReference.md#getdefaultservice)()~~ | Returns the default service of the WebReference object. |
| ~~[getService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.WebReference.md#getservicestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Returns a specific service from this WebReference. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### defaultService
- ~~defaultService: [Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md)~~ `(read-only)`
- : Returns the default service of the WebReference object. If you have more than one service
defined in your WSDL, the default service is the first service alphabetically. If the service
has multiple ports defined, the default service uses the SOAP port name that is first alphabetically.
**Deprecated:**
**warning:** use webreferences2 instead
---
## Constructor Details
### WebReference()
- WebReference()
- :
---
## Method Details
### getDefaultService()
- ~~getDefaultService(): [Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md)~~
- : Returns the default service of the WebReference object. If you have more than one service
defined in your WSDL, the default service is the first service alphabetically. If the service
has multiple ports defined, the default service uses the SOAP port name that is first alphabetically.
**Returns:**
- the default service of the WebReference object.
**Deprecated:**
**warning:** use webreferences2 instead
---
### getService(String, String)
- ~~getService(service: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), port: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Stub](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.Stub.md)~~
- : Returns a specific service from this WebReference.
**Parameters:**
- service - the service to locate.
- port - the port name to use.
```
var port = webref.getService("SampleServiceName","SamplePortName");
```
**Returns:**
- a specific service from this WebReference.
**Deprecated:**
**warning:** use webreferences2 instead
---
# Class WebReference2
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.ws.WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
Represents a web service defined in a WSDL file. The implementation is backed by a JAX-WS framework.
This implementation does not support `RPC/encoded` WSDLs. Such a WSDL must be migrated to a
supported encoding such as `Document/literal` to work with this API.
To create an instance of a WebReference2, you put a web service WSDL file in the `webreferences2`
directory and reference the WSDL file in a B2C Commerce Script. You then request the service [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
using one of the get service methods. For example, if your WSDL file is `MyWSDL.wsdl`,
here is how you create an instance of WebReference2 and access the [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md):
```
var webref : WebReference2 = webreferences2.MyWSDL;
var port : Port = webref.getDefaultService();
```
Note that all script classes representing your WSDL file are placed in the `webreferences2`
package. To use classes in the `webreferences2` package, you do not need to use the `importPackage`
statement in your B2C Commerce Script file.
The generated API may be customized via a property file named `.properties`.
For example, if your WSDL file is `MyWSDL.wsdl`, the property file name is `MyWSDL.wsdl.properties`.
Supported properties include:
| Name | Type | Description |
| --- |--- |--- |
| `namespace` | `boolean` | If the WSDL contains different types with the same name a compilation error may occur. Set this to `true` to generate a namespace-aware [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md), which will have classes separated into packages based on their associated namespace. The default value is `false` |
| `underscoreBinding` | `string` | If you have elements in a WSDL schema that contain the underscore character, code generation may fail. Set this property to `asCharInWord` to resolve the problem. The default value is `asWordSeparator`. |
| `collectionType` | `string` | The generated API will use array types instead of List types for collections when this value is set to `indexed`. This results in code that is more compatible with older `webreferences`-based implementations. The default behavior is to generate Lists. |
| `enableWrapperStyle` | `boolean` | The generated API will use "bare" methods when this is `false`. When this is `true`, "wrapped" methods may be generated instead. The default value is `true`, but a `false` value is more compatible with older `webreferences`-based implementations. |
The messages sent to and from the remote server are logged at DEBUG level on sandboxes, and not logged at all on production.
The custom log category used is derived from the WSDL name and message type. For example, the custom log categories for the file
`MyWSDL.wsdl` are `webreferences2.MyWSDL.request` and `webreferences2.MyWSDL.response`. This
logging is controlled by the following in the WSDL properties:
| Name | Type | Description |
| --- |--- |--- |
| `logging.enabled` | `boolean` | `true` to explicitly allow logging, `false` to disallow. Default is `true` on Sandboxes and `false` on all other instance types |
| `logging.level` | `string` | The logging level to use (`TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`). Default is `DEBUG`. |
| `logging.pretty` | `boolean` | `true` to pretty-print the SOAP XML. Default is `false` to log the actual message body. |
| `logging.verbose` | `boolean` | `true` to log HTTP headers and other message information. Default is `false` to only log the message body |
| `logging.filter.elements` | comma-separated `string` | List of element tag names containing sensitive information. These will be filtered out of the message. All properties with this prefix will be used. For example `logging.filter.elements=Password,Token` is equivalent to two different properties `logging.filter.elements.01=Token` and `logging.filter.elements.02=Token` |
| `logging.filter.headers` | comma-separated `string` | List of message header names containing sensitive information. These will be filtered out of the message. All properties with this prefix will be used. For example `logging.filter.headers=Authorization,Token` is equivalent to two different properties `logging.filter.headers.01=Authorization` and `logging.filter.headers.02=Token` |
**See Also:**
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
- [WebReference](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.rpc.WebReference.md)
## Property Summary
| Property | Description |
| --- | --- |
| [defaultService](#defaultservice): [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md) `(read-only)` | Returns the default service endpoint interface port of the web reference. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WebReference2](#webreference2)() | |
## Method Summary
| Method | Description |
| --- | --- |
| [getDefaultService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md#getdefaultservice)() | Returns the default service endpoint interface port of the web reference. |
| [getService](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md#getservicestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a specific service from this web reference. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### defaultService
- defaultService: [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md) `(read-only)`
- : Returns the default service endpoint interface port of the web reference. The default service is
determined as the first service based on the alphabetic order of the service name, and within
the service the first SOAP port based on the alphabetic order of the port name.
---
## Constructor Details
### WebReference2()
- WebReference2()
- :
---
## Method Details
### getDefaultService()
- getDefaultService(): [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
- : Returns the default service endpoint interface port of the web reference. The default service is
determined as the first service based on the alphabetic order of the service name, and within
the service the first SOAP port based on the alphabetic order of the port name.
**Returns:**
- the default service of the web reference.
---
### getService(String, String)
- getService(service: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), portName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
- : Returns a specific service from this web reference.
**Parameters:**
- service - the service to locate.
- portName - the name of the port to use.
**Returns:**
- a specific service from this web reference.
---
# Class Writer
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.io.Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)
The class supports writing characters to a stream.
**Note:** when this class is used with sensitive data, be careful in persisting sensitive information to disk.
## All Known Subclasses
[FileWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.FileWriter.md), [PrintWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.PrintWriter.md), [StringWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.StringWriter.md)
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [Writer](#writeroutputstream)([OutputStream](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.OutputStream.md)) | Create a writer from a stream using UTF-8 character encoding. |
| [Writer](#writeroutputstream-string)([OutputStream](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.OutputStream.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Create a writer from a stream using the specified character encoding. |
## Method Summary
| Method | Description |
| --- | --- |
| [close](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md#close)() | Closes the writer. |
| [flush](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md#flush)() | Flushes the buffer. |
| [write](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md#writestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Write the given string to the stream. |
| [write](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md#writestring-number-number)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Write the given string to the stream. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### Writer(OutputStream)
- Writer(stream: [OutputStream](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.OutputStream.md))
- : Create a writer from a stream using UTF-8 character encoding.
**Parameters:**
- stream - the output stream to use when creating the writer.
---
### Writer(OutputStream, String)
- Writer(stream: [OutputStream](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.OutputStream.md), encoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
- : Create a writer from a stream using the specified character encoding.
**Parameters:**
- stream - the output stream to use when creating the writer.
- encoding - the encoding to use when creating the writer.
---
## Method Details
### close()
- close(): void
- : Closes the writer.
---
### flush()
- flush(): void
- : Flushes the buffer.
---
### write(String)
- write(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Write the given string to the stream.
**Parameters:**
- str - the string to write to the stream.
---
### write(String, Number, Number)
- write(str: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), off: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), len: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): void
- : Write the given string to the stream.
**Parameters:**
- str - the string to write to the stream.
- off - the offset from which to start writing characters to the stream.
- len - the number of characters to write from the stream.
---
# Class WSUtil
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.ws.WSUtil](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md)
A utility class for performing SOAP-based operations for Web Services
for use with [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md). This class provides
methods for setting SOAP headers and a set of constants representing the
well-known supported header names. You also use this class to set connection and request
timeout values for Web Service calls.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
## Constant Summary
| Constant | Description |
| --- | --- |
| [KEY_ID_TYPE_DIRECT_REFERENCE](#key_id_type_direct_reference): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "DirectReference" | This key identifier method is used when the X.509 Certificate is included in the message. |
| [KEY_ID_TYPE_ENC_KEY_SHA1](#key_id_type_enc_key_sha1): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "EncryptedKeySHA1" | This Key Identifier method only applies for Encryption. |
| [KEY_ID_TYPE_ISSUE_SERIAL](#key_id_type_issue_serial): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "IssuerSerial" | This key identifier method means that the Issuer Name and Serial Number of a X.509 Certificate is included directly in the KeyInfo Element. |
| [KEY_ID_TYPE_SKI_IDENTIFIER](#key_id_type_ski_identifier): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "SKIKeyIdentifier" | This Key Identifier method refers to a Certificate via a Base-64 encoding of the Subject Key Identifier. |
| [KEY_ID_TYPE_THUMBPRINT](#key_id_type_thumbprint): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Thumbprint" | This Key Identifier method refers to the Certificate via a SHA-1 Thumbprint. |
| [KEY_ID_TYPE_X509_KEY_IDENTIFIER](#key_id_type_x509_key_identifier): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "X509KeyIdentifier" | This key identifier method is similar to KEY\_ID\_TYPE\_DIRECT\_REFERENCE, in that the certificate is included in the request. |
| [WS_ACTION](#ws_action): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "action" | WS-Security action property name. |
| [WS_ENCRYPT](#ws_encrypt): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Encrypt" | WS-Security action: Encrypt the message. |
| [WS_ENCRYPTION_PARTS](#ws_encryption_parts): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionParts" | WS-Security Encryption: Defines which parts of the request shall be encrypted. |
| [WS_ENCRYPTION_USER](#ws_encryption_user): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionUser" | WS-Security Encryption: The user's name for encryption. |
| [WS_ENC_KEY_ID](#ws_enc_key_id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionKeyIdentifier" | Defines which key identifier type to use for encryption. |
| [WS_ENC_PROP_KEYSTORE_ALIAS](#ws_enc_prop_keystore_alias): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystoreAlias" | WS-Security Encryption: The encryption and decryption keystore alias name |
| [WS_ENC_PROP_KEYSTORE_PW](#ws_enc_prop_keystore_pw): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystorePassword" | WS-Security Encryption: The encryption and decryption keystore password |
| [WS_ENC_PROP_KEYSTORE_TYPE](#ws_enc_prop_keystore_type): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystoreType" | WS-Security Encryption: The signature keystore type ( jks, pkcs12, or managed ). |
| [WS_NO_SECURITY](#ws_no_security): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "NoSecurity" | WS-Security action: No security. |
| [WS_PASSWORD_TYPE](#ws_password_type): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "passwordType" | WS-Security password type: Parameter for UsernameToken action to define the encoding of the password. |
| [WS_PW_DIGEST](#ws_pw_digest): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PasswordDigest" | WS-Security password type "digest": Use a password digest to send the password information. |
| [WS_PW_TEXT](#ws_pw_text): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PasswordText" | WS-Security password type "text": Send the password information in clear. |
| [WS_SECRETS_MAP](#ws_secrets_map): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SecretsMap" | A secrets map with the username and password entries needed to create the password callback object. |
| [WS_SIGNATURE](#ws_signature): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Signature" | WS-Security action: Sign the message. |
| [WS_SIGNATURE_PARTS](#ws_signature_parts): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureParts" | WS-Security Signature: Defines which parts of the request shall be signed. |
| [WS_SIGNATURE_USER](#ws_signature_user): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureUser" | WS-Security Signature: The user's name for signature. |
| [WS_SIG_DIGEST_ALGO](#ws_sig_digest_algo): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureDigestAlgorithm" | WS-Security Signature: Defines which signature digest algorithm to use. |
| [WS_SIG_KEY_ID](#ws_sig_key_id): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureKeyIdentifier" | Defines which key identifier type to use for signature. |
| [WS_SIG_PROP_KEYSTORE_ALIAS](#ws_sig_prop_keystore_alias): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystoreAlias" | WS-Security Signature: The signature keystore alias name. |
| [WS_SIG_PROP_KEYSTORE_PW](#ws_sig_prop_keystore_pw): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystorePassword" | WS-Security Signature: The signature keystore password. |
| [WS_SIG_PROP_KEYSTORE_TYPE](#ws_sig_prop_keystore_type): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystoreType" | WS-Security: The signature keystore type ( jks, pkcs12, or managed ). |
| [WS_TIMESTAMP](#ws_timestamp): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Timestamp" | WS-Security action: Add a timestamp to the security header. |
| [WS_USER](#ws_user): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "user" | WS-Security user name. |
| [WS_USERNAME_TOKEN](#ws_username_token): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "UsernameToken" | WS-Security action: Add a UsernameToken identification. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [WSUtil](#wsutil)() | |
## Method Summary
| Method | Description |
| --- | --- |
| static [addSOAPHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#addsoapheaderobject-object-boolean-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Adds a header element to the SOAP Header. |
| static [addSOAPHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#addsoapheaderobject-string-boolean-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Adds a header element to the SOAP Header. |
| static [clearSOAPHeaders](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#clearsoapheadersobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Removes all SOAP header elements from the port's request context. |
| static [createHolder](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#createholderobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Creates an jakarta.xml.ws.Holder instance that wraps the specified element. |
| static [getConnectionTimeout](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#getconnectiontimeoutobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns the connection timeout value for the port. |
| static [getHTTPRequestHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#gethttprequestheaderobject-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns an HTTP request header property value using the specified key. |
| static [getProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#getpropertystring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns the value of the SOAP request property using the specified key on a port returned from one of the WebReference2 getService methods. |
| static [getRequestTimeout](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#getrequesttimeoutobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns the read timeout value for a request made on the specified port. |
| static [getResponseProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#getresponsepropertystring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns the property value using the specified key and on a port returned from one of the WebReference2 getService methods. |
| static [isAllowChunking](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#isallowchunkingobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns true if the HTTP request may be chunked, false otherwise |
| static [setAllowChunking](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#setallowchunkingobject-boolean)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)) | Indicate that HTTP chunked Transfer-Encoding may be used. |
| static [setConnectionTimeout](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#setconnectiontimeoutnumber-object)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Sets the connection timeout for the port. |
| static [setHTTPRequestHeader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#sethttprequestheaderobject-string-string)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets an HTTP request header property using the specified key and value. |
| static [setProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#setpropertystring-object-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Set the SOAP request property using the specified key and value on a port returned from one of the WebReference2 getService() methods. |
| static [setRequestTimeout](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#setrequesttimeoutnumber-object)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Sets the read timeout value for a request made on the specified port. |
| static [setUserNamePassword](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#setusernamepasswordstring-string-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Set the user name and password to use with Basic authentication. |
| static [setWSSecurityConfig](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#setwssecurityconfigobject-object-object)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Set the WS-Security configuration for the request and response based on the constants defined (see above). |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### KEY_ID_TYPE_DIRECT_REFERENCE
- KEY_ID_TYPE_DIRECT_REFERENCE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "DirectReference"
- : This key identifier method is used when the X.509 Certificate is included in the message.
The certificate is Base-64 encoded and included in the request via a BinarySecurityToken element
**See Also:**
- [WS_ENC_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_enc_key_id)
- [WS_SIG_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_sig_key_id)
---
### KEY_ID_TYPE_ENC_KEY_SHA1
- KEY_ID_TYPE_ENC_KEY_SHA1: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "EncryptedKeySHA1"
- : This Key Identifier method only applies for Encryption. Unlike the previous methods
it refers to the way the EncryptedData references the EncryptedKey Element,
rather than the way the EncryptedKey Element refers to the public key.
**See Also:**
- [WS_ENC_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_enc_key_id)
---
### KEY_ID_TYPE_ISSUE_SERIAL
- KEY_ID_TYPE_ISSUE_SERIAL: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "IssuerSerial"
- : This key identifier method means that the Issuer Name and Serial Number of a X.509
Certificate is included directly in the KeyInfo Element.
**See Also:**
- [WS_ENC_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_enc_key_id)
- [WS_SIG_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_sig_key_id)
---
### KEY_ID_TYPE_SKI_IDENTIFIER
- KEY_ID_TYPE_SKI_IDENTIFIER: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "SKIKeyIdentifier"
- : This Key Identifier method refers to a Certificate via a Base-64 encoding of the
Subject Key Identifier.
**See Also:**
- [WS_ENC_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_enc_key_id)
- [WS_SIG_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_sig_key_id)
---
### KEY_ID_TYPE_THUMBPRINT
- KEY_ID_TYPE_THUMBPRINT: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Thumbprint"
- : This Key Identifier method refers to the Certificate via a SHA-1 Thumbprint.
The certificate may or may not be included in the request.
**See Also:**
- [WS_ENC_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_enc_key_id)
- [WS_SIG_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_sig_key_id)
---
### KEY_ID_TYPE_X509_KEY_IDENTIFIER
- KEY_ID_TYPE_X509_KEY_IDENTIFIER: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "X509KeyIdentifier"
- : This key identifier method is similar to KEY\_ID\_TYPE\_DIRECT\_REFERENCE, in that the certificate is
included in the request. However, instead of referring to a certificate, the certificate is
included directly in the KeyInfo element.
**See Also:**
- [WS_ENC_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_enc_key_id)
- [WS_SIG_KEY_ID](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#ws_sig_key_id)
---
### WS_ACTION
- WS_ACTION: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "action"
- : WS-Security action property name.
Allowed property values are WS\_NO\_SECURITY, WS\_TIMESTAMP, WS\_ENCRYPT,
WS\_SIGNATURE, WS\_USERNAME\_TOKEN or a space separated list of these values.
---
### WS_ENCRYPT
- WS_ENCRYPT: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Encrypt"
- : WS-Security action: Encrypt the message.
The encryption specific parameters define how to encrypt.
---
### WS_ENCRYPTION_PARTS
- WS_ENCRYPTION_PARTS: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionParts"
- : WS-Security Encryption: Defines which parts of the request shall be encrypted.
---
### WS_ENCRYPTION_USER
- WS_ENCRYPTION_USER: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionUser"
- : WS-Security Encryption: The user's name for encryption.
---
### WS_ENC_KEY_ID
- WS_ENC_KEY_ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "encryptionKeyIdentifier"
- : Defines which key identifier type to use for encryption. Permissible
values are:
- `KEY_ID_TYPE_ISSUE_SERIAL`(default value)
- `KEY_ID_TYPE_DIRECT_REFERENCE`
- `KEY_ID_TYPE_X509_KEY_IDENTIFIER`
- `KEY_ID_TYPE_THUMBPRINT`
- `KEY_ID_TYPE_SKI_IDENTIFIER`
- `KEY_ID_TYPE_ENC_KEY_SHA1`
**See Also:**
- [KEY_ID_TYPE_ISSUE_SERIAL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_issue_serial)
- [KEY_ID_TYPE_DIRECT_REFERENCE](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_direct_reference)
- [KEY_ID_TYPE_X509_KEY_IDENTIFIER](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_x509_key_identifier)
- [KEY_ID_TYPE_THUMBPRINT](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_thumbprint)
- [KEY_ID_TYPE_SKI_IDENTIFIER](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_ski_identifier)
- [KEY_ID_TYPE_ENC_KEY_SHA1](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_enc_key_sha1)
---
### WS_ENC_PROP_KEYSTORE_ALIAS
- WS_ENC_PROP_KEYSTORE_ALIAS: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystoreAlias"
- : WS-Security Encryption: The encryption and decryption keystore alias name
---
### WS_ENC_PROP_KEYSTORE_PW
- WS_ENC_PROP_KEYSTORE_PW: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystorePassword"
- : WS-Security Encryption: The encryption and decryption keystore password
---
### WS_ENC_PROP_KEYSTORE_TYPE
- WS_ENC_PROP_KEYSTORE_TYPE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__EncryptionPropKeystoreType"
- : WS-Security Encryption: The signature keystore type ( jks, pkcs12, or managed ).
The default is jks.
The "managed" type will resolve aliases against the names of certificates and keys in Business Manager.
Note: For non-managed types, the keystore file has the basename of the WSDL file and the
file extension based on the keystore type (e.g. MyService.jks).
The keystore file has to be placed in the same cartridge directory
as the WSDL file.
---
### WS_NO_SECURITY
- WS_NO_SECURITY: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "NoSecurity"
- : WS-Security action: No security.
---
### WS_PASSWORD_TYPE
- WS_PASSWORD_TYPE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "passwordType"
- : WS-Security password type: Parameter for UsernameToken action to define the encoding
of the password. Allowed values are PW\_DIGEST or PW\_TEXT.
---
### WS_PW_DIGEST
- WS_PW_DIGEST: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PasswordDigest"
- : WS-Security password type "digest": Use a password digest to send the password information.
---
### WS_PW_TEXT
- WS_PW_TEXT: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PasswordText"
- : WS-Security password type "text": Send the password information in clear.
---
### WS_SECRETS_MAP
- WS_SECRETS_MAP: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SecretsMap"
- : A secrets map with the username and password entries needed to create the password
callback object.
---
### WS_SIGNATURE
- WS_SIGNATURE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Signature"
- : WS-Security action: Sign the message.
The signature specific parameters define how to sign and which keys
to use.
---
### WS_SIGNATURE_PARTS
- WS_SIGNATURE_PARTS: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureParts"
- : WS-Security Signature: Defines which parts of the request shall be signed.
---
### WS_SIGNATURE_USER
- WS_SIGNATURE_USER: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureUser"
- : WS-Security Signature: The user's name for signature.
---
### WS_SIG_DIGEST_ALGO
- WS_SIG_DIGEST_ALGO: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureDigestAlgorithm"
- : WS-Security Signature: Defines which signature digest algorithm to use.
---
### WS_SIG_KEY_ID
- WS_SIG_KEY_ID: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "signatureKeyIdentifier"
- : Defines which key identifier type to use for signature.
Permissible values are:
- `KEY_ID_TYPE_ISSUE_SERIAL`
- `KEY_ID_TYPE_DIRECT_REFERENCE`(default value)
- `KEY_ID_TYPE_X509_KEY_ID_IDENTIFIER`
- `KEY_ID_TYPE_THUMBPRINT`
- `KEY_ID_TYPE_SKI_IDENTIFIER`
**See Also:**
- [KEY_ID_TYPE_ISSUE_SERIAL](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_issue_serial)
- [KEY_ID_TYPE_DIRECT_REFERENCE](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_direct_reference)
- [KEY_ID_TYPE_X509_KEY_IDENTIFIER](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_x509_key_identifier)
- [KEY_ID_TYPE_THUMBPRINT](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_thumbprint)
- [KEY_ID_TYPE_SKI_IDENTIFIER](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#key_id_type_ski_identifier)
---
### WS_SIG_PROP_KEYSTORE_ALIAS
- WS_SIG_PROP_KEYSTORE_ALIAS: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystoreAlias"
- : WS-Security Signature: The signature keystore alias name.
---
### WS_SIG_PROP_KEYSTORE_PW
- WS_SIG_PROP_KEYSTORE_PW: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystorePassword"
- : WS-Security Signature: The signature keystore password.
---
### WS_SIG_PROP_KEYSTORE_TYPE
- WS_SIG_PROP_KEYSTORE_TYPE: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "__SignaturePropKeystoreType"
- : WS-Security: The signature keystore type ( jks, pkcs12, or managed ).
The default is jks.
The "managed" type will resolve aliases against the names of certificates and keys in Business Manager.
Note: For non-managed types, the keystore file has the basename of the WSDL file and the
file extension based on the keystore type (e.g. MyService.jks).
The keystore file has to be placed in the same cartridge directory
as the WSDL file.
---
### WS_TIMESTAMP
- WS_TIMESTAMP: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "Timestamp"
- : WS-Security action: Add a timestamp to the security header.
---
### WS_USER
- WS_USER: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "user"
- : WS-Security user name.
---
### WS_USERNAME_TOKEN
- WS_USERNAME_TOKEN: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "UsernameToken"
- : WS-Security action: Add a UsernameToken identification.
---
## Constructor Details
### WSUtil()
- WSUtil()
- :
---
## Method Details
### addSOAPHeader(Object, Object, Boolean, String)
- static addSOAPHeader(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), xml: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), mustUnderstand: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), actor: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Adds a header element to the SOAP Header. Each header element should be XML and
it should typically contain a namespace URI.
**Parameters:**
- port - the port.
- xml - the header element XML. The XML should contain a namespace URI.
- mustUnderstand - directs target endpoint to validate payload.
- actor - an URI that identifies that intended recipient of this header element.
---
### addSOAPHeader(Object, String, Boolean, String)
- static addSOAPHeader(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), xml: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), mustUnderstand: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md), actor: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Adds a header element to the SOAP Header. Each header element should be XML and
it should typically contain a namespace URI.
**Parameters:**
- port - the port.
- xml - the header element XML as a String. The XML should contain a namespace URI.
- mustUnderstand - directs target endpoint to validate payload.
- actor - an URI that identifies that intended recipient of this header element.
---
### clearSOAPHeaders(Object)
- static clearSOAPHeaders(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Removes all SOAP header elements from the port's request context.
**Parameters:**
- port - a port returned from one of the WebReference2 getService methods.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### createHolder(Object)
- static createHolder(element: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Creates an jakarta.xml.ws.Holder instance that wraps the specified element. When a WSDL operation is
defined to have an input and output message using the same type, the operation may require the operation's
object to be wrapped in a holder.
**Parameters:**
- element - the element to be wrapped in the Holder.
**Returns:**
- the holder.
---
### getConnectionTimeout(Object)
- static getConnectionTimeout(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the connection timeout value for the port.
**Parameters:**
- port - a port returned from one of the WebReference2 getService methods.
**Returns:**
- the connection timeout value.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### getHTTPRequestHeader(Object, String)
- static getHTTPRequestHeader(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns an HTTP request header property value using the specified key. Null is returned
if the key does not represent an HTTP header property.
**Parameters:**
- port - a port returned from one of the WebReference2 getService methods.
- key - the header property key.
**Returns:**
- an HTTP request header property value using the specified key or null.
---
### getProperty(String, Object)
- static getProperty(key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the value of the SOAP request property using the specified key on a port
returned from one of the WebReference2 getService methods. The property
keys are defined as constants in [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md).
**Parameters:**
- key - the key to use.
- port - the port on which the property is set.
**Returns:**
- the property using the specified key and port.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### getRequestTimeout(Object)
- static getRequestTimeout(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the read timeout value for a request made on the specified port.
If the request exceeds the timeout value, an error is thrown.
**Parameters:**
- port - a port returned from one of the WebReference2 getService methods.
**Returns:**
- the request timeout value for the port.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### getResponseProperty(String, Object)
- static getResponseProperty(key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the property value using the specified key and on a port returned from one of
the WebReference2 getService methods.
**Parameters:**
- key - the key to use.
- port - the port on which the property is set
**Returns:**
- the property using the specified key and port.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### isAllowChunking(Object)
- static isAllowChunking(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns true if the HTTP request may be chunked, false otherwise
**Parameters:**
- port - a port returned from one of the WebReference2 getService methods.
**Returns:**
- returns true if the HTTP request may be chunked and false otherwise
---
### setAllowChunking(Object, Boolean)
- static setAllowChunking(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), allow: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)): void
- : Indicate that HTTP chunked Transfer-Encoding may be used.
The default behavior is true. If false then the request will not
be chunked and the Content-Length will always be sent.
**Parameters:**
- port - a port returned from one of the WebReference2 getService methods.
- allow - true to enable chunking, false otherwise
---
### setConnectionTimeout(Number, Object)
- static setConnectionTimeout(timeoutInMilliseconds: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Sets the connection timeout for the port.
**Parameters:**
- timeoutInMilliseconds - the connection timeout.
- port - a port returned from one of the WebReference2 getService methods.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### setHTTPRequestHeader(Object, String, String)
- static setHTTPRequestHeader(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Sets an HTTP request header property using the specified key and value.
**Parameters:**
- port - a port returned from one of the WebReference2 getService methods.
- key - the header property key.
- value - the header property value. If the value is null, the property identified by the key is removed from the HTTP request header.
---
### setProperty(String, Object, Object)
- static setProperty(key: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Set the SOAP request property using the specified key and value on a port
returned from one of the WebReference2 getService() methods. The property
keys are defined as constants in [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md).
**Parameters:**
- key - the key to use.
- value - the value.
- port - the port on which the property is set.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### setRequestTimeout(Number, Object)
- static setRequestTimeout(timeoutInMilliseconds: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Sets the read timeout value for a request made on the specified port.
If the request exceeds the timeout value, an error is thrown.
**Parameters:**
- timeoutInMilliseconds - the timeout.
- port - a port returned from one of the WebReference2 getService methods.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### setUserNamePassword(String, String, Object)
- static setUserNamePassword(userName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), password: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Set the user name and password to use with Basic authentication. For stronger
authentication, use the [setWSSecurityConfig(Object, Object, Object)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#setwssecurityconfigobject-object-object) method.
**Parameters:**
- userName - the user name.
- password - the password.
- port - a port returned from one of the WebReference2 getService methods.
**See Also:**
- [setWSSecurityConfig(Object, Object, Object)](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WSUtil.md#setwssecurityconfigobject-object-object)
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
### setWSSecurityConfig(Object, Object, Object)
- static setWSSecurityConfig(port: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), requestConfigMap: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), responseConfigMap: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Set the WS-Security configuration for the request and response based on the
constants defined (see above).
**Parameters:**
- port - a port returned from one of the WebReference2 getService methods.
- requestConfigMap - the WS-Security request configuration.
- responseConfigMap - the WS-Security response configuration.
**See Also:**
- [WebReference2](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.WebReference2.md)
- [Port](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.ws.Port.md)
---
# Class X509Certificate
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.crypto.CertificateRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md)
- [dw.crypto.X509Certificate](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.X509Certificate.md)
Represents an X.509 public key certificate as defined in RFC 5280.
It provides access to the standard fields of an X.509 certificate including version, serial number, validity period,
distinguished names, and signature algorithm.
## Property Summary
| Property | Description |
| --- | --- |
| [issuerDN](#issuerdn): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the X.500 distinguished name of the entity that signed this certificate. |
| [notAfter](#notafter): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)` | Returns the end date of the certificate validity period. |
| [notBefore](#notbefore): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)` | Returns the start date of the certificate validity period. |
| [serialNumber](#serialnumber): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the certificate serial number in string format. |
| [sigAlgName](#sigalgname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the algorithm used to sign this certificate. |
| [subjectDN](#subjectdn): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the X.500 distinguished name of the entity this certificate belongs to. |
| [version](#version): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the X.509 certificate version number. |
## Constructor Summary
This class does not have a constructor, so you cannot create it directly.
## Method Summary
| Method | Description |
| --- | --- |
| [getIssuerDN](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.X509Certificate.md#getissuerdn)() | Returns the X.500 distinguished name of the entity that signed this certificate. |
| [getNotAfter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.X509Certificate.md#getnotafter)() | Returns the end date of the certificate validity period. |
| [getNotBefore](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.X509Certificate.md#getnotbefore)() | Returns the start date of the certificate validity period. |
| [getSerialNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.X509Certificate.md#getserialnumber)() | Returns the certificate serial number in string format. |
| [getSigAlgName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.X509Certificate.md#getsigalgname)() | Returns the algorithm used to sign this certificate. |
| [getSubjectDN](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.X509Certificate.md#getsubjectdn)() | Returns the X.500 distinguished name of the entity this certificate belongs to. |
| [getVersion](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.X509Certificate.md#getversion)() | Returns the X.509 certificate version number. |
### Methods inherited from class CertificateRef
[toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.crypto.CertificateRef.md#tostring)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### issuerDN
- issuerDN: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the X.500 distinguished name of the entity that signed this certificate.
---
### notAfter
- notAfter: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)`
- : Returns the end date of the certificate validity period.
---
### notBefore
- notBefore: [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md) `(read-only)`
- : Returns the start date of the certificate validity period.
---
### serialNumber
- serialNumber: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the certificate serial number in string format. The serial number is a unique positive integer assigned
by the CA to each certificate.
---
### sigAlgName
- sigAlgName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the algorithm used to sign this certificate. The name follows the format defined in RFC 5280 (e.g.,
"SHA256withRSA", "SHA384withECDSA").
---
### subjectDN
- subjectDN: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the X.500 distinguished name of the entity this certificate belongs to.
---
### version
- version: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the X.509 certificate version number.
---
## Method Details
### getIssuerDN()
- getIssuerDN(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the X.500 distinguished name of the entity that signed this certificate.
**Returns:**
- the issuer's X.500 distinguished name
---
### getNotAfter()
- getNotAfter(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Returns the end date of the certificate validity period.
**Returns:**
- the date after which this certificate is not valid
---
### getNotBefore()
- getNotBefore(): [Date](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Date.md)
- : Returns the start date of the certificate validity period.
**Returns:**
- the date before which this certificate is not valid
---
### getSerialNumber()
- getSerialNumber(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the certificate serial number in string format. The serial number is a unique positive integer assigned
by the CA to each certificate.
**Returns:**
- the certificate serial number as a string
---
### getSigAlgName()
- getSigAlgName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the algorithm used to sign this certificate. The name follows the format defined in RFC 5280 (e.g.,
"SHA256withRSA", "SHA384withECDSA").
**Returns:**
- the signature algorithm name
---
### getSubjectDN()
- getSubjectDN(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the X.500 distinguished name of the entity this certificate belongs to.
**Returns:**
- the subject's X.500 distinguished name
---
### getVersion()
- getVersion(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the X.509 certificate version number.
**Returns:**
- certificate version (typically 1, 2, or 3)
---
# Class XML
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
The XML object contains functions and properties for working with XML
instances. The XML object implements the powerful XML-handling standards
defined in the ECMA-357 specification (known as "E4X").
Use the toXMLString() method to return a string representation of the XML
object regardless of whether the XML object has simple content or complex
content.
Do not create large XML objects in memory to avoid out-of-memory conditions.
When dealing with XML streams use [XMLStreamReader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md) and
[XMLStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md). The following example shows how:
```
var id : String = "p42";
var pname : String = "a product";
// use E4X syntax
var product : XML =
{pname}
;
product.shortdesc = "a fine product";
product.longdesc = "this is a fine product";
var xmlString = product.toXMLString();
fileWriter.write(xmlString);
```
The code above will write the following to file:
```
a product
a fine product
this is a fine product
```
Do not create large XML objects in memory to avoid out-of-memory conditions.
When dealing with XML streams use [XMLStreamReader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md) and
[XMLStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md).
## Property Summary
| Property | Description |
| --- | --- |
| [ignoreComments](#ignorecomments): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) | The ignoreComments property determines whether or not XML comments are ignored when XML objects parse the source XML data. |
| [ignoreProcessingInstructions](#ignoreprocessinginstructions): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) | The ignoreProcessingInstructions property determines whether or not XML processing instructions are ignored when XML objects parse the source XML data. |
| [ignoreWhitespace](#ignorewhitespace): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) | The ignoreWhitespace property determines whether or not white space characters at the beginning and end of text nodes are ignored during parsing. |
| [prettyIndent](#prettyindent): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The prettyIndent property determines the amount of indentation applied by the toString() and toXMLString() methods when the XML.prettyPrinting property is set to true. |
| [prettyPrinting](#prettyprinting): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) | The prettyPrinting property determines whether the toString() and toXMLString() methods normalize white space characters between some tags. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [XML](#xml)() | Creates a new XML object. |
| [XML](#xmlobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Creates a new XML object. |
## Method Summary
| Method | Description |
| --- | --- |
| [addNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#addnamespaceobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Adds a namespace to the set of in-scope namespaces for the XML object. |
| [appendChild](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#appendchildobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Appends the specified child to the end of the object's properties. |
| [attribute](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#attributestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the attribute associated with this XML object that is identified by the specified name. |
| [attributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#attributes)() | Returns an XMList of the attributes in this XML Object. |
| [child](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#childobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns the children of the XML object based on the specified property name. |
| [childIndex](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#childindex)() | Identifies the zero-based index of this XML object within the context of its parent, or -1 if this object has no parent. |
| [children](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#children)() | Returns an XMLList containing the children of this XML object, maintaing the sequence in which they appear. |
| [comments](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#comments)() | Returns the properties of the XML object that contain comments. |
| [contains](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#containsxml)([XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)) | Returns true if this XML object contains the specified XML object, false otherwise. |
| [copy](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#copy)() | Returns a copy of the this XML object including duplicate copies of the entire tree of nodes. |
| static [defaultSettings](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#defaultsettings)() | Returns a new Object with the following properties set to the default values: ignoreComments, ignoreProcessingInstructions, ignoreWhitespace, prettyIndent, and prettyPrinting. |
| [descendants](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#descendants)() | Returns all descendents of the XML object. |
| [descendants](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#descendantsstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns all descendents of the XML object that have the specified name parameter. |
| [elements](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#elements)() | Returns a list of all of the elements of the XML object. |
| [elements](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#elementsobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns a list of the elements of the XML object using the specified name to constrain the list. |
| [hasComplexContent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#hascomplexcontent)() | Returns a Boolean value indicating whether this XML object contains complex content. |
| [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#hasownpropertystring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a Boolean value indicating whether this object has the property specified by _prop_. |
| [hasSimpleContent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#hassimplecontent)() | Returns a Boolean value indicating whether this XML object contains simple content. |
| [inScopeNamespaces](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#inscopenamespaces)() | Returns an Array of Namespace objects representing the namespaces in scope for this XML object in the context of its parent. |
| [insertChildAfter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#insertchildafterobject-object)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Inserts the specified _child2_ after the specified _child1_ in this XML object and returns this XML object. |
| [insertChildBefore](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#insertchildbeforeobject-object)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Inserts the specified _child2_ before the specified _child1_ in this XML object and returns this XML object. |
| [length](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#length)() | Returns a value of 1 for XML objects. |
| [localName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#localname)() | Returns the local name portion of the qualified name of the XML object. |
| [name](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#name)() | Returns the qualified name for the XML object. |
| [namespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#namespace)() | Returns the namespace associated with the qualified name of this XML object. |
| [namespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#namespacestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the namespace that matches the specified prefix and that is in scope for the XML object. |
| [namespaceDeclarations](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#namespacedeclarations)() | Returns an Array of namespace declarations associated with the XML Obnject in the context of its parent. |
| [nodeKind](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#nodekind)() | Returns the type of the XML object, such as _text_, _comment_, _processing-instruction_, or _attribute_. |
| [normalize](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#normalize)() | Merges adjacent text nodes and eliminates and eliminates empty text nodes for this XML object and all its descendents. |
| [parent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#parent)() | Returns the parent of the XML object or null if the XML object does not have a parent. |
| [prependChild](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#prependchildobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Inserts the specified child into this XML object prior to its existing XML properties and then returns this XML object. |
| [processingInstructions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#processinginstructions)() | Returns an XMLList containing all the children of this XML object that are processing-instructions. |
| [processingInstructions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#processinginstructionsstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns an XMLList containing all the children of this XML object that are processing-instructions with the specified _name_. |
| [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#propertyisenumerablestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a Boolean indicating whether the specified _property_ will be included in the set of properties iterated over when this XML object is used in a _for..in_ statement. |
| [removeNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#removenamespacenamespace)([Namespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Namespace.md)) | Removes the specified namespace from the in scope namespaces of this object and all its descendents, then returns a copy of this XML object. |
| [replace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#replacestring-object)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Replaces the XML properties of this XML object specified by _propertyName_ with _value_ and returns this updated XML object. |
| [setChildren](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#setchildrenobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Replaces the XML properties of this XML object with a new set of XML properties from _value_. |
| [setLocalName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#setlocalnamestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Replaces the local name of this XML object with a string constructed from the specified _name_. |
| [setName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#setnamestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Replaces the name of this XML object with a QName or AttributeName constructed from the specified _name_. |
| [setNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#setnamespacenamespace)([Namespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Namespace.md)) | Replaces the namespace associated with the name of this XML object with the specified _namespace_. |
| static [setSettings](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#setsettings)() | Restores the default settings for the following XML properties: XML.ignoreComments = true XML.ignoreProcessingInstructions = true XML.ignoreWhitespace = true XML.prettyIndent = 2 XML.prettyPrinting = true |
| static [setSettings](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#setsettingsobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Updates the collection of global XML properties: ignoreComments, ignoreProcessingInstructions, ignoreWhitespace, prettyPrinting, prettyIndent, and prettyPrinting. |
| static [settings](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#settings)() | Returns the collection of global XML properties: ignoreComments, ignoreProcessingInstructions, ignoreWhitespace, prettyPrinting, prettyIndent, and prettyPrinting. |
| [text](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#text)() | Returns an XMLList containing all XML properties of this XML object that represent XML text nodes. |
| [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#tostring)() | Returns the String representation of the XML object. |
| [toXMLString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#toxmlstring)() | Returns a XML-encoded String representation of the XML object, including tag and attributed delimiters. |
| [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md#valueof)() | Returns this XML object. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### ignoreComments
- ignoreComments: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : The ignoreComments property determines whether or not XML comments are
ignored when XML objects parse the source XML data.
---
### ignoreProcessingInstructions
- ignoreProcessingInstructions: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : The ignoreProcessingInstructions property determines whether or not XML
processing instructions are ignored when XML objects parse the source XML data.
---
### ignoreWhitespace
- ignoreWhitespace: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : The ignoreWhitespace property determines whether or not white space
characters at the beginning and end of text nodes are ignored during parsing.
---
### prettyIndent
- prettyIndent: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The prettyIndent property determines the amount of indentation applied by
the toString() and toXMLString() methods when the XML.prettyPrinting
property is set to true.
---
### prettyPrinting
- prettyPrinting: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : The prettyPrinting property determines whether the toString() and toXMLString()
methods normalize white space characters between some tags.
---
## Constructor Details
### XML()
- XML()
- : Creates a new XML object.
---
### XML(Object)
- XML(value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Creates a new XML object.
You must use the constructor to create an XML object before you
call any of the methods of the XML class.
Use the toXMLString() method to return a string representation
of the XML object regardless of whether the XML object has simple
content or complex content.
**Parameters:**
- value - any Object that can be converted to XML via the top-level XML() function.
---
## Method Details
### addNamespace(Object)
- addNamespace(ns: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Adds a namespace to the set of in-scope namespaces for the XML object.
If the namespace already exists in the in-scope namespaces for the XML
object, then the prefix of the existing namespace is set to _undefined_.
If _ns_ is a Namespace instance, it is used directly.
However, if _ns_ is a QName instance, the input parameter's URI is used
to create a new namespace. If _ns_ is not a Namespace or QName instance,
_ns_ is converted to a String and a namespace is created from the String.
**Parameters:**
- ns - the namespace to add to the XML object.
**Returns:**
- a new XML object, with the namespace added.
---
### appendChild(Object)
- appendChild(child: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Appends the specified child to the end of the object's properties.
_child_ should be a XML object, an XMLList object or any other
data type that will then be converted to a String.
**Parameters:**
- child - the object to append to this XML object.
**Returns:**
- the XML object with the child appended.
---
### attribute(String)
- attribute(attributeName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns the attribute associated with this XML object that
is identified by the specified name.
**Parameters:**
- attributeName - the name of the attribute.
**Returns:**
- the value of the attribute as either an XMLList or an empty XMLList
---
### attributes()
- attributes(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns an XMList of the attributes in this XML Object.
**Returns:**
- an XMList of the attributes in this XML Object.
---
### child(Object)
- child(propertyName: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns the children of the XML object based on the specified
property name.
**Parameters:**
- propertyName - the property name representing the children of this XML object.
**Returns:**
- an XMLList of children that match the property name
parameter.
---
### childIndex()
- childIndex(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Identifies the zero-based index of this XML object within
the context of its parent, or -1 if this object has no parent.
**Returns:**
- the index of this XML object in the context of
its parent, or -1 if this object has no parent.
---
### children()
- children(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns an XMLList containing the children of this XML object, maintaing
the sequence in which they appear.
**Returns:**
- an XMLList containing the children of this XML object.
---
### comments()
- comments(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns the properties of the XML object that contain comments.
**Returns:**
- properties of the XML object that contain comments.
---
### contains(XML)
- contains(value: [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns true if this XML object contains the specified
XML object, false otherwise.
**Parameters:**
- value - the object to locate in this XML object.
**Returns:**
- true if this XML object contains the specified
XML object, false otherwise.
---
### copy()
- copy(): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Returns a copy of the this XML object including
duplicate copies of the entire tree of nodes.
The copied XML object has no parent.
**Returns:**
- the copy of the object.
---
### defaultSettings()
- static defaultSettings(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns a new Object with the following properties set to the default values:
ignoreComments, ignoreProcessingInstructions, ignoreWhitespace, prettyIndent,
and prettyPrinting. The default values are as follows:
- ignoreComments = true
- ignoreProcessingInstructions = true
- ignoreWhitespace = true
- prettyIndent = 2
- prettyPrinting = true
Be aware that this method does not apply the settings to an existing instance
of an XML object. Instead, this method returns an Object containing the
default settings.
**Returns:**
- an Object with properties set to the default settings.
---
### descendants()
- descendants(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns all descendents of the XML object.
**Returns:**
- a list of all descendents of the XML object.
---
### descendants(String)
- descendants(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns all descendents of the XML object that
have the specified name parameter. To return all descendents,
use \* as the _name_ parameter.
**Parameters:**
- name - the name of the element to match. To return all descendents, use \* as the _name_ parameter.
**Returns:**
- a list of all descendents constrained by the name parameter.
---
### elements()
- elements(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns a list of all of the elements of the XML object.
---
### elements(Object)
- elements(name: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns a list of the elements of the XML object using the
specified name to constrain the list. _name_ can be a
QName, String, or any other data type that will be converted
to a string prior to performing the search for elements of that
name.
To list all objects use \* for the value of _name_.
**Parameters:**
- name - the name of the elements to return or an \* to return all elements.
**Returns:**
- a list of the elements of the XML object using the
specified name to constrain the list.
---
### hasComplexContent()
- hasComplexContent(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns a Boolean value indicating whether
this XML object contains complex content. An XML object is considered
to contain complex content if it represents an XML element that has
child elements. XML objects representing attributes, comments, processing
instructions and text nodes do not have complex content. The existence of
attributes, comments, processing instructions and text nodes within an XML
object is not significant in determining if it has complex content.
**Returns:**
- a Boolean value indicating whether this XML object contains complex content.
---
### hasOwnProperty(String)
- hasOwnProperty(prop: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns a Boolean value indicating whether this object has the
property specified by _prop_.
**Parameters:**
- prop - the property to locate.
**Returns:**
- true if the property exists, false otherwise.
---
### hasSimpleContent()
- hasSimpleContent(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns a Boolean value indicating whether this XML object contains
simple content. An XML object is considered to contain simple
content if it represents a text node, represents an attribute node
or if it represents an XML element that has no child elements. XML
objects representing comments and processing instructions do not
have simple content. The existence of attributes, comments,
processing instructions and text nodes within an XML object is not
significant in determining if it has simple content.
**Returns:**
- a Boolean value indicating whether this XML object contains
simple content.
---
### inScopeNamespaces()
- inScopeNamespaces(): [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md)
- : Returns an Array of Namespace objects representing the namespaces
in scope for this XML object in the context of its parent. If the
parent of this XML object is modified, the associated namespace
declarations may change. The set of namespaces returned by this
method may be a super set of the namespaces used by this value
**Returns:**
- an Array of Namespace objects representing the namespaces
in scope for this XML object in the context of its parent.
---
### insertChildAfter(Object, Object)
- insertChildAfter(child1: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), child2: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Inserts the specified _child2_ after the specified _child1_
in this XML object and returns this XML object. If _child1_ is null,
inserts _child2_ before all children of
this XML object. If _child1_ does not exist
in this XML object, it returns without modifying this XML object.
**Parameters:**
- child1 - the child after which _child2_ is inserted.
- child2 - the child to insert into this XML object.
**Returns:**
- the updated XML object.
---
### insertChildBefore(Object, Object)
- insertChildBefore(child1: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), child2: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Inserts the specified _child2_ before the specified _child1_
in this XML object and returns this XML object. If _child1_ is null,
inserts _child2_ after all children of
this XML object. If _child1_ does not exist
in this XML object, it returns without modifying this XML object.
**Parameters:**
- child1 - the child before which _child2_ is inserted.
- child2 - the child to insert into this XML object.
**Returns:**
- the updated XML object.
---
### length()
- length(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns a value of 1 for XML objects.
**Returns:**
- the value of 1.
---
### localName()
- localName(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the local name portion of the qualified name of the XML object.
**Returns:**
- the local name as either a String or null.
---
### name()
- name(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the qualified name for the XML object.
**Returns:**
- the qualified name as either a QName or null.
---
### namespace()
- namespace(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the namespace associated with the qualified name
of this XML object.
**Returns:**
- the namespace associated with the qualified name
of this XML object.
---
### namespace(String)
- namespace(prefix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the namespace that matches the specified prefix and
that is in scope for the XML object. if there is no such
namespace, the method returns undefined.
**Parameters:**
- prefix - the prefix to use when attempting to locate a namespace.
**Returns:**
- the namespace that matches the specified prefix and
that is in scope for the XML object. If specified
namespace does not exist, the method returns undefined.
---
### namespaceDeclarations()
- namespaceDeclarations(): [Array](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Array.md)
- : Returns an Array of namespace declarations associated
with the XML Obnject in the context of its parent.
**Returns:**
- an Array of namespace declarations associated
with the XML Obnject in the context of its parent.
---
### nodeKind()
- nodeKind(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the type of the XML object, such
as _text_, _comment_, _processing-instruction_,
or _attribute_.
**Returns:**
- the type of the XML object.
---
### normalize()
- normalize(): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Merges adjacent text nodes and eliminates and eliminates
empty text nodes for this XML object and all its
descendents.
**Returns:**
- the normalized XML object.
---
### parent()
- parent(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the parent of the XML object
or null if the XML object does not have
a parent.
**Returns:**
- the parent of the XML object
of null if the XML object does not have
a parent.
---
### prependChild(Object)
- prependChild(value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Inserts the specified child into this XML object
prior to its existing XML properties and then returns
this XML object.
**Parameters:**
- value - the child to prepend to this XML object.
**Returns:**
- the XML object updated with the prepended child.
---
### processingInstructions()
- processingInstructions(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns an XMLList containing all the children of this XML object
that are processing-instructions.
**Returns:**
- an XMLList containing all the children of this XML object
that are processing-instructions.
---
### processingInstructions(String)
- processingInstructions(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns an XMLList containing all the children of this XML object
that are processing-instructions with the specified _name_. If you
use \* for the name, all processing-instructions are returned.
**Parameters:**
- name - the name representing the processing-instructions you want to retreive.
**Returns:**
- an XMLList containing all the children of this XML object
that are processing-instructions with the specified _name_.
---
### propertyIsEnumerable(String)
- propertyIsEnumerable(property: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns a Boolean indicating whether the specified
_property_ will be included in the set of properties iterated
over when this XML object is used in a _for..in_ statement.
**Parameters:**
- property - the property to test.
**Returns:**
- true when the property can be iterated in a _for..in_
statement, false otherwise.
---
### removeNamespace(Namespace)
- removeNamespace(ns: [Namespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Namespace.md)): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Removes the specified namespace from the in scope namespaces
of this object and all its descendents, then returns a copy of
this XML object. This method will not remove a namespace from
an object when it is referenced by that object's QName or
the ONames of that object's attributes.
**Parameters:**
- ns - the namespace to remove.
**Returns:**
- a copy of this XML object with the namespace removed.
---
### replace(String, Object)
- replace(propertyName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Replaces the XML properties of this XML object specified by
_propertyName_ with _value_ and returns this
updated XML object. If this XML object contains no properties
that match _propertyName_, the replace method returns without
modifying this XML object.
The _propertyName_ parameter may be a numeric property name,
an unqualified name for a set of XML elements, a qualified
name for a set of XML elements or the properties wildcard \*.
When the _propertyName_ parameter is an unqualified name,
it identifies XML elements in the default namespace. The _value_
parameter may be an XML object, XMLList object or any value
that may be converted to a String.
**Parameters:**
- propertyName - a numeric property name, an unqualified name for a set of XML elements, a qualified name for a set of XML elements or the properties wildcard \*.
- value - an XML object, XMLList object or any value that may be converted to a String.
**Returns:**
- the updated XML object.
---
### setChildren(Object)
- setChildren(value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Replaces the XML properties of this XML object
with a new set of XML properties from _value_.
**Parameters:**
- value - a single XML object or an XMLList.
**Returns:**
- the updated XML object.
---
### setLocalName(String)
- setLocalName(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Replaces the local name of this XML object with
a string constructed from the specified _name_.
**Parameters:**
- name - the new local name.
---
### setName(String)
- setName(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Replaces the name of this XML object with a
QName or AttributeName constructed from the specified
_name_.
**Parameters:**
- name - the new name of this XML object.
---
### setNamespace(Namespace)
- setNamespace(ns: [Namespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Namespace.md)): void
- : Replaces the namespace associated with the name of
this XML object with the specified _namespace_.
**Parameters:**
- ns - the namespace to associated with the name of thix XML object.
---
### setSettings()
- static setSettings(): void
- : Restores the default settings for the following XML
properties:
- XML.ignoreComments = true
- XML.ignoreProcessingInstructions = true
- XML.ignoreWhitespace = true
- XML.prettyIndent = 2
- XML.prettyPrinting = true
---
### setSettings(Object)
- static setSettings(settings: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): void
- : Updates the collection of global XML properties:
ignoreComments, ignoreProcessingInstructions, ignoreWhitespace,
prettyPrinting, prettyIndent, and prettyPrinting.
**Parameters:**
- settings - an object with each of the following properties: ignoreComments, ignoreProcessingInstructions, ignoreWhitespace, prettyIndent, and prettyPrinting.
---
### settings()
- static settings(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the collection of global XML properties:
ignoreComments, ignoreProcessingInstructions, ignoreWhitespace,
prettyPrinting, prettyIndent, and prettyPrinting.
**Returns:**
- an object with each of the following properties:
ignoreComments, ignoreProcessingInstructions, ignoreWhitespace,
prettyIndent, and prettyPrinting.
---
### text()
- text(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns an XMLList containing all XML properties of
this XML object that represent XML text nodes.
**Returns:**
- an XMLList containing all XML properties of
this XML object that represent XML text nodes.
---
### toString()
- toString(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the String representation of the XML object. If the object contains
simple content, this method returns a String with tag, attributes, and
namespace declarations removed. However, if the object contains complex
content, this method returns an XML encoded String representing the entire
XML object. If you want to return the entire XML object regardless of
content complexity, use the _toXMLString()_ method.
**Returns:**
- the String representation of the XML object.
---
### toXMLString()
- toXMLString(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns a XML-encoded String representation of the XML object, including tag and
attributed delimiters.
**Returns:**
- the string representation of the XML object.
---
### valueOf()
- valueOf(): [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)
- : Returns this XML object.
**Returns:**
- this XML object.
---
# Class XMLIndentingStreamWriter
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.io.XMLStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md)
- [dw.io.XMLIndentingStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLIndentingStreamWriter.md)
A XMLIndentingStreamWriter writes the XML output formatted for good
readability.
**Note:** when this class is used with sensitive data, be careful
in persisting sensitive information to disk.
## Property Summary
| Property | Description |
| --- | --- |
| [indent](#indent): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Returns the indent. |
| [newLine](#newline): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Returns the string that is used for a new line character. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [XMLIndentingStreamWriter](#xmlindentingstreamwriterwriter)([Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)) | Constructs the writer for the specified writer. |
## Method Summary
| Method | Description |
| --- | --- |
| [getIndent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLIndentingStreamWriter.md#getindent)() | Returns the indent. |
| [getNewLine](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLIndentingStreamWriter.md#getnewline)() | Returns the string that is used for a new line character. |
| [setIndent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLIndentingStreamWriter.md#setindentstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Specifies a string that will be used as identing characters. |
| [setNewLine](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLIndentingStreamWriter.md#setnewlinestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets the string that is used for a new line character. |
### Methods inherited from class XMLStreamWriter
[close](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#close), [flush](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#flush), [getDefaultNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#getdefaultnamespace), [getPrefix](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#getprefixstring), [setDefaultNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#setdefaultnamespacestring), [setPrefix](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#setprefixstring-string), [writeAttribute](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeattributestring-string), [writeAttribute](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeattributestring-string-string), [writeAttribute](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeattributestring-string-string-string), [writeCData](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writecdatastring), [writeCharacters](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writecharactersstring), [writeComment](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writecommentstring), [writeDTD](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writedtdstring), [writeDefaultNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writedefaultnamespacestring), [writeEmptyElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeemptyelementstring), [writeEmptyElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeemptyelementstring-string), [writeEmptyElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeemptyelementstring-string-string), [writeEndDocument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeenddocument), [writeEndElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeendelement), [writeEntityRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeentityrefstring), [writeNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writenamespacestring-string), [writeProcessingInstruction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeprocessinginstructionstring), [writeProcessingInstruction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeprocessinginstructionstring-string), [writeRaw](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writerawstring), [writeStartDocument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartdocument), [writeStartDocument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartdocumentstring), [writeStartDocument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartdocumentstring-string), [writeStartElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartelementstring), [writeStartElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartelementstring-string), [writeStartElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartelementstring-string-string)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### indent
- indent: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the indent.
---
### newLine
- newLine: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the string that is used for a new line character. The
default is the normal new line character.
---
## Constructor Details
### XMLIndentingStreamWriter(Writer)
- XMLIndentingStreamWriter(writer: [Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md))
- : Constructs the writer for the specified writer.
**Parameters:**
- writer - the writer to use.
---
## Method Details
### getIndent()
- getIndent(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the indent.
**Returns:**
- Returns the indent.
---
### getNewLine()
- getNewLine(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the string that is used for a new line character. The
default is the normal new line character.
**Returns:**
- the new line.
---
### setIndent(String)
- setIndent(indent: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Specifies a string that will be used as identing characters. The
default are two space characters.
**Parameters:**
- indent - The indent to set.
---
### setNewLine(String)
- setNewLine(newLine: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Sets the string that is used for a new line character.
**Parameters:**
- newLine - The newLine to set.
---
# Class XMLList
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
An XMLList object is an ordered collection of properties.
A XMLList object represents a XML document, an XML fragment,
or an arbitrary collection of XML objects.
An individual XML object is the same thing as an XMLList
containing only that XML object. All operations available
for the XML object are also available for an XMLList object
that contains exactly one XML object.
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [XMLList](#xmllistobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Creates a new XMLList object using the specified _value_. |
## Method Summary
| Method | Description |
| --- | --- |
| [attribute](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#attributestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the attribute associated with this XMLList object that is identified by the specified name. |
| [attributes](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#attributes)() | Returns an XMList of the attributes in this XMLList Object. |
| [child](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#childobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Returns the children of the XMLList object based on the specified property name. |
| [children](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#children)() | Returns an XMLList containing the children of this XMLList object, maintaing the sequence in which they appear. |
| [comments](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#comments)() | Returns the properties of the XMLList object that contain comments. |
| [contains](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#containsxml)([XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)) | Returns true if this XMLList object contains the specified XML object, false otherwise. |
| [copy](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#copy)() | Returns a deep copy of the this XMLList object. |
| [descendants](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#descendants)() | Calls the _descendants()_ method of each XML object in this XMLList object and returns an XMLList containing the results concatenated in order. |
| [descendants](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#descendantsstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Calls the _descendants(name)_ method of each XML object in this XMLList object and returns an XMLList containing the results concatenated in order. |
| [elements](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#elements)() | Calls the _elements()_ method in each XML object in this XMLList object and returns an XMLList containing the results concatenated in order. |
| [elements](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#elementsobject)([Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)) | Calls the _elements(name)_ method in each of the XML objects in this XMLList object and returns an XMLList containing the results concatenated in order. |
| [hasComplexContent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#hascomplexcontent)() | Returns a Boolean value indicating whether this XMLList object contains complex content. |
| [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#hasownpropertystring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a Boolean value indicating whether this object has the property specified by _prop_. |
| [hasSimpleContent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#hassimplecontent)() | Returns a Boolean value indicating whether this XML object contains simple content. |
| [length](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#length)() | Returns the number of children in this XMLList object. |
| [normalize](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#normalize)() | Puts all text nodes in this XMLList, all the XML objects it contains and the descendents of all the XML objects it contains into a normal form by merging adjacent text nodes and eliminating empty text nodes. |
| [parent](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#parent)() | Returns the parent of the XMLList object or null if the XMLList object does not have a parent. |
| [processingInstructions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#processinginstructions)() | Calls the _processingInstructions()_ method of each XML object in this XMLList object and returns an XMList containing the results in order. |
| [processingInstructions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#processinginstructionsstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Calls the _processingInstructions(name)_ method of each XML object in this XMLList object and returns an XMList containing the results in order. |
| [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#propertyisenumerablestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns a Boolean indicating whether the specified _property_ will be included in the set of properties iterated over when this XML object is used in a _for..in_ statement. |
| [text](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#text)() | Calls the _text()_ method of each XML object contained in this XMLList object and returns an XMLList containing the results concatenated in order. |
| [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#tostring)() | Returns the String representation of this XMLList object. |
| [toXMLString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#toxmlstring)() | Returns an XML-encoded String representation of the XMLList object by calling the _toXMLString_ method on each property contained within this XMLList object. |
| [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md#valueof)() | Returns this XMLList object. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constructor Details
### XMLList(Object)
- XMLList(value: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))
- : Creates a new XMLList object using the
specified _value_.
**Parameters:**
- value - the value to use.
---
## Method Details
### attribute(String)
- attribute(attributeName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns the attribute associated with this XMLList object that
is identified by the specified name.
**Parameters:**
- attributeName - the name of the attribute.
**Returns:**
- the value of the attribute as either an XMLList or an empty XMLList
---
### attributes()
- attributes(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns an XMList of the attributes in this XMLList Object.
**Returns:**
- an XMList of the attributes in this XMLList Object.
---
### child(Object)
- child(propertyName: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns the children of the XMLList object based on the specified
property name.
**Parameters:**
- propertyName - the property name representing the children of this XMLList object.
**Returns:**
- an XMLList of children that match the property name
parameter.
---
### children()
- children(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns an XMLList containing the children of this XMLList object, maintaing
the sequence in which they appear.
**Returns:**
- an XMLList containing the children of this XMLList object.
---
### comments()
- comments(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns the properties of the XMLList object that contain comments.
**Returns:**
- properties of the XMLList object that contain comments.
---
### contains(XML)
- contains(value: [XML](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XML.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns true if this XMLList object contains the specified
XML object, false otherwise.
**Parameters:**
- value - the object to locate in this XMLList object.
**Returns:**
- true if this XMLList object contains the specified
XML object, false otherwise.
---
### copy()
- copy(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns a deep copy of the this XMLList object.
**Returns:**
- the deep copy of the object.
---
### descendants()
- descendants(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Calls the _descendants()_ method of each XML object in this XMLList
object and returns an XMLList containing the
results concatenated in order.
**Returns:**
- a list of all descendents of the XML objects in this XMLList object.
---
### descendants(String)
- descendants(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Calls the _descendants(name)_ method of each XML object in this XMLList
object and returns an XMLList containing the
results concatenated in order.
**Parameters:**
- name - the name of the element to match. To return all descendents, use \* as the _name_ parameter.
**Returns:**
- a list of all descendents of the XML objects in this XMLList
constrained by the _name_ parameter.
---
### elements()
- elements(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Calls the _elements()_ method in each XML object in this XMLList
object and returns an XMLList containing the results concatenated in order.
---
### elements(Object)
- elements(name: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Calls the _elements(name)_ method in each of the XML objects in
this XMLList object and returns an XMLList containing the results
concatenated in order. _name_ can be a
QName, String, or any other data type that will be converted
to a string prior to performing the search for elements of that
name.
To list all objects use \* for the value of _name_.
**Parameters:**
- name - the name of the elements to return.
**Returns:**
- a list of all elements of the XML objects in this XMLList
constrained by the _name_ parameter.
---
### hasComplexContent()
- hasComplexContent(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns a Boolean value indicating whether
this XMLList object contains complex content. An XMLList object is considered
to contain complex content if it is not empty, contains a single XML item
with complex content or contains elements.
**Returns:**
- a Boolean value indicating whether this XMLList object contains complex content.
---
### hasOwnProperty(String)
- hasOwnProperty(prop: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns a Boolean value indicating whether this object has the
property specified by _prop_.
**Parameters:**
- prop - the property to locate.
**Returns:**
- true if the property exists, false otherwise.
---
### hasSimpleContent()
- hasSimpleContent(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns a Boolean value indicating whether this XML object contains
simple content. An XMLList object is considered to contain simple
content if it is empty, contains a single XML item with simple
content or contains no elements.
**Returns:**
- a Boolean value indicating whether this XML object contains
simple content.
---
### length()
- length(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the number of children in this XMLList
object.
**Returns:**
- the number of children in this XMLList
object.
---
### normalize()
- normalize(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Puts all text nodes in this XMLList, all the XML objects it
contains and the descendents of all the XML objects it
contains into a normal form by merging adjacent text nodes
and eliminating empty text nodes.
**Returns:**
- the XMLList object containing normailzed objects.
---
### parent()
- parent(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Returns the parent of the XMLList object
or null if the XMLList object does not have
a parent.
**Returns:**
- the parent of the XMLList object
or null if the XMLList object does not have
a parent.
---
### processingInstructions()
- processingInstructions(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Calls the _processingInstructions()_ method of each XML object
in this XMLList object and returns an XMList containing the results
in order.
**Returns:**
- an XMLList contaiing the result of calling the
_processingInstructions()_ method of each XML object
in this XMLList object.
---
### processingInstructions(String)
- processingInstructions(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Calls the _processingInstructions(name)_ method of each XML object
in this XMLList object and returns an XMList containing the results
in order.
**Parameters:**
- name - the name representing the processing-instructions you want to retreive.
**Returns:**
- an XMLList containing the result of calling the
_processingInstructions(name)_ method of each XML object
in this XMLList object.
---
### propertyIsEnumerable(String)
- propertyIsEnumerable(property: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns a Boolean indicating whether the specified
_property_ will be included in the set of properties iterated
over when this XML object is used in a _for..in_ statement.
**Parameters:**
- property - the property to test.
**Returns:**
- true when the property can be iterated in a _for..in_
statement, false otherwise.
---
### text()
- text(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Calls the _text()_ method of each XML object contained
in this XMLList object and returns an XMLList containing
the results concatenated in order.
**Returns:**
- the concatenated results of calling the _text()_
method of every XML object contained in this XMLList.
---
### toString()
- toString(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the String representation of this XMLList object.
**Returns:**
- the String representation of this XMLList object.
---
### toXMLString()
- toXMLString(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns an XML-encoded String representation of the XMLList object
by calling the _toXMLString_ method on each property contained
within this XMLList object.
**Returns:**
- an XML-encoded String representation of the XMLList object
by calling the _toXMLString_ method on each property contained
within this XMLList object.
---
### valueOf()
- valueOf(): [XMLList](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLList.md)
- : Returns this XMLList object.
**Returns:**
- this XMLList object.
---
# Class XMLStreamConstants
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.io.XMLStreamConstants](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamConstants.md)
Useful constants for working with XML streams.
## Constant Summary
| Constant | Description |
| --- | --- |
| [ATTRIBUTE](#attribute): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 10 | Represents an attribute in an element. |
| [CDATA](#cdata): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 12 | Represents a CDATA section in an element. |
| [CHARACTERS](#characters): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 4 | Represents the character data in an XML document. |
| [COMMENT](#comment): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 5 | Represents a comment in an XML document. |
| [DTD](#dtd): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 11 | Represents the document type definition. |
| [END_DOCUMENT](#end_document): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 8 | Represents the end of an XML document. |
| [END_ELEMENT](#end_element): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2 | Represents the end of an element in an XML document. |
| [ENTITY_DECLARATION](#entity_declaration): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 15 | Represents the entity declaration in an XML document. |
| [ENTITY_REFERENCE](#entity_reference): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 9 | Represents an entity reference in an XML document. |
| [NAMESPACE](#namespace): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 13 | Represents a namespace declaration in an XML document. |
| [NOTATION_DECLARATION](#notation_declaration): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 14 | Represents the notation declaration in an XML document. |
| [PROCESSING_INSTRUCTION](#processing_instruction): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 3 | Represents processing instruction in an XML document. |
| [SPACE](#space): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 6 | Represents a space in an XML document. |
| [START_DOCUMENT](#start_document): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 7 | Represents the start of an XML document. |
| [START_ELEMENT](#start_element): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1 | Represents the start of an element in an XML document. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [XMLStreamConstants](#xmlstreamconstants)() | |
## Method Summary
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Constant Details
### ATTRIBUTE
- ATTRIBUTE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 10
- : Represents an attribute in an element.
---
### CDATA
- CDATA: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 12
- : Represents a CDATA section in an element.
---
### CHARACTERS
- CHARACTERS: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 4
- : Represents the character data in an XML document.
---
### COMMENT
- COMMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 5
- : Represents a comment in an XML document.
---
### DTD
- DTD: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 11
- : Represents the document type definition.
---
### END_DOCUMENT
- END_DOCUMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 8
- : Represents the end of an XML document.
---
### END_ELEMENT
- END_ELEMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 2
- : Represents the end of an element in an XML document.
---
### ENTITY_DECLARATION
- ENTITY_DECLARATION: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 15
- : Represents the entity declaration in an XML document.
---
### ENTITY_REFERENCE
- ENTITY_REFERENCE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 9
- : Represents an entity reference in an XML document.
---
### NAMESPACE
- NAMESPACE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 13
- : Represents a namespace declaration in an XML document.
---
### NOTATION_DECLARATION
- NOTATION_DECLARATION: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 14
- : Represents the notation declaration in an XML document.
---
### PROCESSING_INSTRUCTION
- PROCESSING_INSTRUCTION: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 3
- : Represents processing instruction in an XML document.
---
### SPACE
- SPACE: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 6
- : Represents a space in an XML document.
---
### START_DOCUMENT
- START_DOCUMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 7
- : Represents the start of an XML document.
---
### START_ELEMENT
- START_ELEMENT: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) = 1
- : Represents the start of an element in an XML document.
---
## Constructor Details
### XMLStreamConstants()
- XMLStreamConstants()
- :
---
# Class XMLStreamError
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [TopLevel.Error](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md)
- [TopLevel.XMLStreamError](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.XMLStreamError.md)
This error indicates an XML streaming related error in the system. The IOError
is always related to a systems internal Java exception. The class provides
access to some more details about this internal Java exception. In particular
the class informs about the location of the error.
## Property Summary
| Property | Description |
| --- | --- |
| [causeFullName](#causefullname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | If the exception is associated with a root cause, the property contains the full name of the associated Java exception. |
| [causeMessage](#causemessage): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | If the exception is associated with a root cause, the property contains the message of the associated Java exception. |
| [causeName](#causename): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | If the exception is associated with a root cause, the property contains the simplified name of the associated Java exception. |
| [javaFullName](#javafullname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | The full name of the underlying Java exception. |
| [javaMessage](#javamessage): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | The message of the underlying Java exception. |
| [javaName](#javaname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | The simplified name of the underlying Java exception. |
| [xmlColumnNumber](#xmlcolumnnumber): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The column number where the error occured. |
| [xmlLineNumber](#xmllinenumber): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The line where the error occured. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [XMLStreamError](#xmlstreamerror)() | |
## Method Summary
### Methods inherited from class Error
[captureStackTrace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#capturestacktraceerror-function), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Error.md#tostring)
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### causeFullName
- causeFullName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : If the exception is associated with a root cause, the property
contains the full name of the associated Java exception.
---
### causeMessage
- causeMessage: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : If the exception is associated with a root cause, the property
contains the message of the associated Java exception.
---
### causeName
- causeName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : If the exception is associated with a root cause, the property
contains the simplified name of the associated Java exception.
---
### javaFullName
- javaFullName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The full name of the underlying Java exception.
---
### javaMessage
- javaMessage: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The message of the underlying Java exception.
---
### javaName
- javaName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : The simplified name of the underlying Java exception.
---
### xmlColumnNumber
- xmlColumnNumber: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The column number where the error occured.
---
### xmlLineNumber
- xmlLineNumber: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : The line where the error occured.
---
## Constructor Details
### XMLStreamError()
- XMLStreamError()
- :
---
# Class XMLStreamReader
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.io.XMLStreamReader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md)
The XMLStreamReader allows forward, read-only access to XML. It is designed
to be the lowest level and most efficient way to read XML data.
The XMLStreamReader is designed to iterate over XML using
next() and hasNext(). The data can be accessed using methods such as getEventType(),
getNamespaceURI(), getLocalName() and getText();
The [next()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#next) method causes the reader to read the next parse event.
The next() method returns an integer which identifies the type of event just read.
The event type can be determined using [getEventType()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#geteventtype).
Parsing events are defined as the XML Declaration, a DTD,
start tag, character data, white space, end tag, comment,
or processing instruction. An attribute or namespace event may be encountered
at the root level of a document as the result of a query operation.
The following table describes which methods are valid in what state.
If a method is called in an invalid state the method will throw a
java.lang.IllegalStateException.
| Valid methods for each state |
| --- |
| Event Type | Valid Methods |
| All States | getProperty(), hasNext(), require(), close(), getNamespaceURI(), isStartElement(), isEndElement(), isCharacters(), isWhiteSpace(), getNamespaceContext(), getEventType(),getLocation(), hasText(), hasName() |
| START\_ELEMENT | next(), getName(), getLocalName(), hasName(), getPrefix(), getAttributeXXX(), isAttributeSpecified(), getNamespaceXXX(), getElementText(), nextTag(), getXMLObject() |
| ATTRIBUTE | next(), nextTag() getAttributeXXX(), isAttributeSpecified(), |
| NAMESPACE | next(), nextTag() getNamespaceXXX() |
| END\_ELEMENT | next(), getName(), getLocalName(), hasName(), getPrefix(), getNamespaceXXX(), nextTag() |
| CHARACTERS | next(), getTextXXX(), nextTag() |
| CDATA | next(), getTextXXX(), nextTag() |
| COMMENT | next(), getTextXXX(), nextTag() |
| SPACE | next(), getTextXXX(), nextTag() |
| START\_DOCUMENT | next(), getEncoding(), getVersion(), isStandalone(), standaloneSet(), getCharacterEncodingScheme(), nextTag() |
| END\_DOCUMENT | close() |
| PROCESSING\_INSTRUCTION | next(), getPITarget(), getPIData(), nextTag() |
| ENTITY\_REFERENCE | next(), getLocalName(), getText(), nextTag() |
| DTD | next(), getText(), nextTag() |
The following is a code sample to read an XML file containing multiple
"myobject" sub-elements. Only one myObject instance is kept in memory at
any given time to keep memory consumption low:
```
var fileReader : FileReader = new FileReader(file, "UTF-8");
var xmlStreamReader : XMLStreamReader = new XMLStreamReader(fileReader);
while (xmlStreamReader.hasNext())
{
if (xmlStreamReader.next() == XMLStreamConstants.START_ELEMENT)
{
var localElementName : String = xmlStreamReader.getLocalName();
if (localElementName == "myobject")
{
// read single "myobject" as XML
var myObject : XML = xmlStreamReader.getXMLObject();
// process myObject
}
}
}
xmlStreamReader.close();
fileReader.close();
```
## Property Summary
| Property | Description |
| --- | --- |
| [PIData](#pidata): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Get the data section of a processing instruction. |
| [PITarget](#pitarget): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Get the target of a processing instruction. |
| ~~[XMLObject](#xmlobject): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)~~ `(read-only)` | Reads a sub-tree of the XML document and parses it as XML object. |
| [attributeCount](#attributecount): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the count of attributes on this START\_ELEMENT, this method is only valid on a START\_ELEMENT or ATTRIBUTE. |
| [characterEncodingScheme](#characterencodingscheme): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the character encoding declared on the XML declaration Returns null if none was declared. |
| [characters](#characters): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Identifies if the cursor points to a character data event. |
| [columnNumber](#columnnumber): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the column number where the current event ends or -1 if none is available. |
| ~~[elementText](#elementtext): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ `(read-only)` | Reads the content of a text-only element, an exception is thrown if this is not a text-only element. |
| [encoding](#encoding): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Return input encoding if known or null if unknown. |
| [endElement](#endelement): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Identifies if the cursor points to an end tag. |
| [eventType](#eventtype): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns an integer code that indicates the type of the event the cursor is pointing to. |
| [lineNumber](#linenumber): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the line number where the current event ends or -1 if none is available. |
| [localName](#localname): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the (local) name of the current event. |
| [namespaceCount](#namespacecount): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the count of namespaces declared on this START\_ELEMENT or END\_ELEMENT, this method is only valid on a START\_ELEMENT, END\_ELEMENT or NAMESPACE. |
| [namespaceURI](#namespaceuri): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | If the current event is a START\_ELEMENT or END\_ELEMENT this method returns the URI of the prefix or the default namespace. |
| [prefix](#prefix): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the prefix of the current event or null if the event does not have a prefix |
| [standalone](#standalone): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Get the standalone declaration from the xml declaration. |
| [startElement](#startelement): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Identifies if the cursor points to a start tag. |
| [text](#text): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY\_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. |
| [textLength](#textlength): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the length of the sequence of characters for this Text event within the text character array. |
| [textStart](#textstart): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)` | Returns the offset into the text character array where the first character (of this text event) is stored. |
| [version](#version): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)` | Get the xml version declared on the xml declaration. |
| [whiteSpace](#whitespace): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)` | Identifies if the cursor points to a character data event that consists of all whitespace. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [XMLStreamReader](#xmlstreamreaderreader)([Reader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Reader.md)) | Constructs the stream readon on behalf of the reader. |
## Method Summary
| Method | Description |
| --- | --- |
| [close](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#close)() | Frees any resources associated with this Reader. |
| [getAttributeCount](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getattributecount)() | Returns the count of attributes on this START\_ELEMENT, this method is only valid on a START\_ELEMENT or ATTRIBUTE. |
| [getAttributeLocalName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getattributelocalnamenumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the localName of the attribute at the provided index. |
| [getAttributeNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getattributenamespacenumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the namespace of the attribute at the provided index. |
| [getAttributePrefix](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getattributeprefixnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the prefix of this attribute at the provided index. |
| [getAttributeType](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getattributetypenumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the XML type of the attribute at the provided index. |
| [getAttributeValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getattributevaluenumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the value of the attribute at the index. |
| [getAttributeValue](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getattributevaluestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality |
| [getCharacterEncodingScheme](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getcharacterencodingscheme)() | Returns the character encoding declared on the XML declaration Returns null if none was declared. |
| [getColumnNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getcolumnnumber)() | Returns the column number where the current event ends or -1 if none is available. |
| ~~[getElementText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getelementtext)()~~ | Reads the content of a text-only element, an exception is thrown if this is not a text-only element. |
| [getEncoding](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getencoding)() | Return input encoding if known or null if unknown. |
| [getEventType](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#geteventtype)() | Returns an integer code that indicates the type of the event the cursor is pointing to. |
| [getLineNumber](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getlinenumber)() | Returns the line number where the current event ends or -1 if none is available. |
| [getLocalName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getlocalname)() | Returns the (local) name of the current event. |
| [getNamespaceCount](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getnamespacecount)() | Returns the count of namespaces declared on this START\_ELEMENT or END\_ELEMENT, this method is only valid on a START\_ELEMENT, END\_ELEMENT or NAMESPACE. |
| [getNamespacePrefix](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getnamespaceprefixnumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the prefix for the namespace declared at the index. |
| [getNamespaceURI](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getnamespaceuri)() | If the current event is a START\_ELEMENT or END\_ELEMENT this method returns the URI of the prefix or the default namespace. |
| [getNamespaceURI](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getnamespaceurinumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the uri for the namespace declared at the index. |
| [getNamespaceURI](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getnamespaceuristring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Return the uri for the given prefix. |
| [getPIData](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getpidata)() | Get the data section of a processing instruction. |
| [getPITarget](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getpitarget)() | Get the target of a processing instruction. |
| [getPrefix](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getprefix)() | Returns the prefix of the current event or null if the event does not have a prefix |
| [getText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#gettext)() | Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY\_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. |
| [getTextLength](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#gettextlength)() | Returns the length of the sequence of characters for this Text event within the text character array. |
| [getTextStart](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#gettextstart)() | Returns the offset into the text character array where the first character (of this text event) is stored. |
| [getVersion](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getversion)() | Get the xml version declared on the xml declaration. |
| ~~[getXMLObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#getxmlobject)()~~ | Reads a sub-tree of the XML document and parses it as XML object. |
| [hasName](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#hasname)() | Identifies if the current event has a name (is a START\_ELEMENT or END\_ELEMENT) |
| [hasNext](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#hasnext)() | Returns true if there are more parsing events and false if there are no more events. |
| [hasText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#hastext)() | Indicates if the current event has text. |
| [isAttributeSpecified](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#isattributespecifiednumber)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Identifies if this attribute was created by default. |
| [isCharacters](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#ischaracters)() | Identifies if the cursor points to a character data event. |
| [isEndElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#isendelement)() | Identifies if the cursor points to an end tag. |
| [isStandalone](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#isstandalone)() | Get the standalone declaration from the xml declaration. |
| [isStartElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#isstartelement)() | Identifies if the cursor points to a start tag. |
| [isWhiteSpace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#iswhitespace)() | Identifies if the cursor points to a character data event that consists of all whitespace. |
| [next](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#next)() | Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks. |
| [nextTag](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#nexttag)() | Skips any white space (isWhiteSpace() returns true), COMMENT, or PROCESSING\_INSTRUCTION, until a START\_ELEMENT or END\_ELEMENT is reached. |
| [readElementText](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#readelementtext)() | Reads the content of a text-only element, an exception is thrown if this is not a text-only element. |
| [readXMLObject](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#readxmlobject)() | Reads a sub-tree of the XML document and parses it as XML object. |
| [require](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#requirenumber-string-string)([Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event. |
| [standaloneSet](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#standaloneset)() | Identifies if standalone was set in the document. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### PIData
- PIData: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Get the data section of a processing instruction.
---
### PITarget
- PITarget: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Get the target of a processing instruction.
---
### XMLObject
- ~~XMLObject: [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)~~ `(read-only)`
- : Reads a sub-tree of the XML document and parses it as XML object.
The stream must be positioned on a START\_ELEMENT. Do not call the method
when the stream is positioned at document's root element. This would
cause the whole document to be parsed into a single XML what may lead to
an out-of-memory condition. Instead use \#next() to navigate to
sub-elements and invoke getXMLObject() there. Do not keep references to
more than the currently processed XML to keep memory consumption low. The
method reads the stream up to the matching END\_ELEMENT. When the method
returns the current event is the END\_ELEMENT event.
**Deprecated:**
**warning:** Use [readXMLObject()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#readxmlobject)
---
### attributeCount
- attributeCount: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the count of attributes on this START\_ELEMENT,
this method is only valid on a START\_ELEMENT or ATTRIBUTE. This
count excludes namespace definitions. Attribute indices are
zero-based.
---
### characterEncodingScheme
- characterEncodingScheme: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the character encoding declared on the XML declaration
Returns null if none was declared.
---
### characters
- characters: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Identifies if the cursor points to a character data event.
---
### columnNumber
- columnNumber: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the column number where the current event ends or -1 if none is
available.
---
### elementText
- ~~elementText: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ `(read-only)`
- : Reads the content of a text-only element, an exception is thrown if this is not a text-only element. This method
always returns coalesced content.
Precondition: the current event is START\_ELEMENT.
Postcondition: the current event is the corresponding END\_ELEMENT.
The method does the following (implementations are free to be optimized but must do equivalent processing):
```
if ( getEventType() != XMLStreamConstants.START_ELEMENT )
{
throw new XMLStreamException( "parser must be on START_ELEMENT to read next text", getLocation() );
}
int eventType = next();
StringBuffer content = new StringBuffer();
while ( eventType != XMLStreamConstants.END_ELEMENT )
{
if ( eventType == XMLStreamConstants.CHARACTERS || eventType == XMLStreamConstants.CDATA
|| eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.ENTITY_REFERENCE )
{
buf.append( getText() );
}
else if ( eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT )
{
// skipping
}
else if ( eventType == XMLStreamConstants.END_DOCUMENT )
{
throw new XMLStreamException( "unexpected end of document when reading element text content", this );
}
else if ( eventType == XMLStreamConstants.START_ELEMENT )
{
throw new XMLStreamException( "element text content may not contain START_ELEMENT", getLocation() );
}
else
{
throw new XMLStreamException( "Unexpected event type " + eventType, getLocation() );
}
eventType = next();
}
return buf.toString();
```
**Deprecated:**
**warning:** Use [readElementText()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#readelementtext)
---
### encoding
- encoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Return input encoding if known or null if unknown.
---
### endElement
- endElement: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Identifies if the cursor points to an end tag.
---
### eventType
- eventType: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns an integer code that indicates the type
of the event the cursor is pointing to.
---
### lineNumber
- lineNumber: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the line number where the current event ends or -1 if none is
available.
---
### localName
- localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the (local) name of the current event.
For START\_ELEMENT or END\_ELEMENT returns the (local) name of the current element.
For ENTITY\_REFERENCE it returns entity name.
The current event must be START\_ELEMENT or END\_ELEMENT,
or ENTITY\_REFERENCE.
---
### namespaceCount
- namespaceCount: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the count of namespaces declared on this START\_ELEMENT or END\_ELEMENT,
this method is only valid on a START\_ELEMENT, END\_ELEMENT or NAMESPACE. On
an END\_ELEMENT the count is of the namespaces that are about to go
out of scope. This is the equivalent of the information reported
by SAX callback for an end element event.
---
### namespaceURI
- namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : If the current event is a START\_ELEMENT or END\_ELEMENT this method
returns the URI of the prefix or the default namespace.
Returns null if the event does not have a prefix.
---
### prefix
- prefix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the prefix of the current event or null if the event does not have a prefix
---
### standalone
- standalone: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Get the standalone declaration from the xml declaration.
---
### startElement
- startElement: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Identifies if the cursor points to a start tag.
---
### text
- text: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Returns the current value of the parse event as a string,
this returns the string value of a CHARACTERS event,
returns the value of a COMMENT, the replacement value
for an ENTITY\_REFERENCE, the string value of a CDATA section,
the string value for a SPACE event,
or the String value of the internal subset of the DTD.
If an ENTITY\_REFERENCE has been resolved, any character data
will be reported as CHARACTERS events.
---
### textLength
- textLength: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the length of the sequence of characters for this
Text event within the text character array.
---
### textStart
- textStart: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
- : Returns the offset into the text character array where the first
character (of this text event) is stored.
---
### version
- version: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
- : Get the xml version declared on the xml declaration.
Returns null if none was declared.
---
### whiteSpace
- whiteSpace: [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
- : Identifies if the cursor points to a character data event
that consists of all whitespace.
---
## Constructor Details
### XMLStreamReader(Reader)
- XMLStreamReader(reader: [Reader](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Reader.md))
- : Constructs the stream readon on behalf of the reader.
**Parameters:**
- reader - the reader to use.
---
## Method Details
### close()
- close(): void
- : Frees any resources associated with this Reader. This method does not close the
underlying reader.
---
### getAttributeCount()
- getAttributeCount(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the count of attributes on this START\_ELEMENT,
this method is only valid on a START\_ELEMENT or ATTRIBUTE. This
count excludes namespace definitions. Attribute indices are
zero-based.
**Returns:**
- returns the number of attributes.
---
### getAttributeLocalName(Number)
- getAttributeLocalName(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the localName of the attribute at the provided
index.
**Parameters:**
- index - the position of the attribute.
**Returns:**
- the local name of the attribute.
---
### getAttributeNamespace(Number)
- getAttributeNamespace(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the namespace of the attribute at the provided
index.
**Parameters:**
- index - the position of the attribute
**Returns:**
- the namespace URI (can be null)
---
### getAttributePrefix(Number)
- getAttributePrefix(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the prefix of this attribute at the
provided index.
**Parameters:**
- index - the position of the attribute.
**Returns:**
- the prefix of the attribute.
---
### getAttributeType(Number)
- getAttributeType(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the XML type of the attribute at the provided
index.
**Parameters:**
- index - the position of the attribute.
**Returns:**
- the XML type of the attribute.
---
### getAttributeValue(Number)
- getAttributeValue(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the value of the attribute at the
index.
**Parameters:**
- index - the position of the attribute.
**Returns:**
- the attribute value.
---
### getAttributeValue(String, String)
- getAttributeValue(namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the normalized attribute value of the
attribute with the namespace and localName
If the namespaceURI is null the namespace
is not checked for equality
**Parameters:**
- namespaceURI - the namespace of the attribute
- localName - the local name of the attribute, cannot be null
**Returns:**
- returns the value of the attribute or null if not found.
---
### getCharacterEncodingScheme()
- getCharacterEncodingScheme(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the character encoding declared on the XML declaration
Returns null if none was declared.
**Returns:**
- the encoding declared in the document or null.
---
### getColumnNumber()
- getColumnNumber(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the column number where the current event ends or -1 if none is
available.
**Returns:**
- the column number or -1.
---
### getElementText()
- ~~getElementText(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
- : Reads the content of a text-only element, an exception is thrown if this is not a text-only element. This method
always returns coalesced content.
Precondition: the current event is START\_ELEMENT.
Postcondition: the current event is the corresponding END\_ELEMENT.
The method does the following (implementations are free to be optimized but must do equivalent processing):
```
if ( getEventType() != XMLStreamConstants.START_ELEMENT )
{
throw new XMLStreamException( "parser must be on START_ELEMENT to read next text", getLocation() );
}
int eventType = next();
StringBuffer content = new StringBuffer();
while ( eventType != XMLStreamConstants.END_ELEMENT )
{
if ( eventType == XMLStreamConstants.CHARACTERS || eventType == XMLStreamConstants.CDATA
|| eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.ENTITY_REFERENCE )
{
buf.append( getText() );
}
else if ( eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT )
{
// skipping
}
else if ( eventType == XMLStreamConstants.END_DOCUMENT )
{
throw new XMLStreamException( "unexpected end of document when reading element text content", this );
}
else if ( eventType == XMLStreamConstants.START_ELEMENT )
{
throw new XMLStreamException( "element text content may not contain START_ELEMENT", getLocation() );
}
else
{
throw new XMLStreamException( "Unexpected event type " + eventType, getLocation() );
}
eventType = next();
}
return buf.toString();
```
**Deprecated:**
**warning:** Use [readElementText()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#readelementtext)
---
### getEncoding()
- getEncoding(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Return input encoding if known or null if unknown.
**Returns:**
- the encoding of this instance or null
---
### getEventType()
- getEventType(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns an integer code that indicates the type
of the event the cursor is pointing to.
**Returns:**
- an integer code that indicates the type
of the event the cursor is pointing to.
---
### getLineNumber()
- getLineNumber(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the line number where the current event ends or -1 if none is
available.
**Returns:**
- the line number or -1.
---
### getLocalName()
- getLocalName(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the (local) name of the current event.
For START\_ELEMENT or END\_ELEMENT returns the (local) name of the current element.
For ENTITY\_REFERENCE it returns entity name.
The current event must be START\_ELEMENT or END\_ELEMENT,
or ENTITY\_REFERENCE.
**Returns:**
- the local name.
---
### getNamespaceCount()
- getNamespaceCount(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the count of namespaces declared on this START\_ELEMENT or END\_ELEMENT,
this method is only valid on a START\_ELEMENT, END\_ELEMENT or NAMESPACE. On
an END\_ELEMENT the count is of the namespaces that are about to go
out of scope. This is the equivalent of the information reported
by SAX callback for an end element event.
**Returns:**
- returns the number of namespace declarations on this specific element.
---
### getNamespacePrefix(Number)
- getNamespacePrefix(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the prefix for the namespace declared at the
index. Returns null if this is the default namespace
declaration.
**Parameters:**
- index - the position of the namespace declaration.
**Returns:**
- returns the namespace prefix.
---
### getNamespaceURI()
- getNamespaceURI(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : If the current event is a START\_ELEMENT or END\_ELEMENT this method
returns the URI of the prefix or the default namespace.
Returns null if the event does not have a prefix.
**Returns:**
- the URI bound to this elements prefix, the default namespace, or null.
---
### getNamespaceURI(Number)
- getNamespaceURI(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the uri for the namespace declared at the
index.
**Parameters:**
- index - the position of the namespace declaration.
**Returns:**
- returns the namespace uri.
---
### getNamespaceURI(String)
- getNamespaceURI(prefix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Return the uri for the given prefix.
The uri returned depends on the current state of the processor.
**NOTE:**The 'xml' prefix is bound as defined in
[Namespaces in XML](http://www.w3.org/TR/REC-xml-names/\#ns-using)
specification to "http://www.w3.org/XML/1998/namespace".
**NOTE:** The 'xmlns' prefix must be resolved to following namespace
[http://www.w3.org/2000/xmlns/](http://www.w3.org/2000/xmlns/)
**Parameters:**
- prefix - The prefix to lookup, may not be null
**Returns:**
- the uri bound to the given prefix or null if it is not bound
---
### getPIData()
- getPIData(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the data section of a processing instruction.
**Returns:**
- the data or null.
---
### getPITarget()
- getPITarget(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the target of a processing instruction.
**Returns:**
- the target or null.
---
### getPrefix()
- getPrefix(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the prefix of the current event or null if the event does not have a prefix
**Returns:**
- the prefix or null.
---
### getText()
- getText(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the current value of the parse event as a string,
this returns the string value of a CHARACTERS event,
returns the value of a COMMENT, the replacement value
for an ENTITY\_REFERENCE, the string value of a CDATA section,
the string value for a SPACE event,
or the String value of the internal subset of the DTD.
If an ENTITY\_REFERENCE has been resolved, any character data
will be reported as CHARACTERS events.
**Returns:**
- the current text or null.
---
### getTextLength()
- getTextLength(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the length of the sequence of characters for this
Text event within the text character array.
**Returns:**
- the length of the sequence of characters for this
Text event within the text character array.
---
### getTextStart()
- getTextStart(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Returns the offset into the text character array where the first
character (of this text event) is stored.
**Returns:**
- the offset into the text character array where the first
character (of this text event) is stored.
---
### getVersion()
- getVersion(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Get the xml version declared on the xml declaration.
Returns null if none was declared.
**Returns:**
- the XML version or null.
---
### getXMLObject()
- ~~getXMLObject(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)~~
- : Reads a sub-tree of the XML document and parses it as XML object.
The stream must be positioned on a START\_ELEMENT. Do not call the method
when the stream is positioned at document's root element. This would
cause the whole document to be parsed into a single XML what may lead to
an out-of-memory condition. Instead use \#next() to navigate to
sub-elements and invoke getXMLObject() there. Do not keep references to
more than the currently processed XML to keep memory consumption low. The
method reads the stream up to the matching END\_ELEMENT. When the method
returns the current event is the END\_ELEMENT event.
**Deprecated:**
**warning:** Use [readXMLObject()](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamReader.md#readxmlobject)
---
### hasName()
- hasName(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Identifies if the current event has a name (is a START\_ELEMENT or END\_ELEMENT)
**Returns:**
- true if the current event has a name, false otherwise.
---
### hasNext()
- hasNext(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Returns true if there are more parsing events and false
if there are no more events. This method will return
false if the current state of the XMLStreamReader is
END\_DOCUMENT
**Returns:**
- true if there are more events, false otherwise
---
### hasText()
- hasText(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Indicates if the current event has text.
The following events have text:
CHARACTERS,DTD ,ENTITY\_REFERENCE, COMMENT, SPACE.
**Returns:**
- true if the current event has text, false otherwise.
---
### isAttributeSpecified(Number)
- isAttributeSpecified(index: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Identifies if this
attribute was created by default.
**Parameters:**
- index - the position of the attribute.
**Returns:**
- true if this is a default attribute, false otherwise.
---
### isCharacters()
- isCharacters(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Identifies if the cursor points to a character data event.
**Returns:**
- true if the cursor points to character data, false otherwise.
---
### isEndElement()
- isEndElement(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Identifies if the cursor points to an end tag.
**Returns:**
- true if the cursor points to an end tag, false otherwise.
---
### isStandalone()
- isStandalone(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Get the standalone declaration from the xml declaration.
**Returns:**
- true if this is standalone, or false otherwise.
---
### isStartElement()
- isStartElement(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Identifies if the cursor points to a start tag.
**Returns:**
- true if the cursor points to a start tag, false otherwise.
---
### isWhiteSpace()
- isWhiteSpace(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Identifies if the cursor points to a character data event
that consists of all whitespace.
**Returns:**
- true if the cursor points to all whitespace, false otherwise.
---
### next()
- next(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Get next parsing event - a processor may return all contiguous
character data in a single chunk, or it may split it into several chunks.
If the property javax.xml.stream.isCoalescing is set to true
element content must be coalesced and only one CHARACTERS event
must be returned for contiguous element content or
CDATA Sections.
By default entity references must be
expanded and reported transparently to the application.
An exception will be thrown if an entity reference cannot be expanded.
If element content is empty (i.e. content is "") then no CHARACTERS event will be reported.
Given the following XML:
content textHello]]>other content
The behavior of calling next() when being on foo will be:
1- the comment (COMMENT)
2- then the characters section (CHARACTERS)
3- then the CDATA section (another CHARACTERS)
4- then the next characters section (another CHARACTERS)
5- then the END\_ELEMENT
**NOTE:** empty element (such as ) will be reported
with two separate events: START\_ELEMENT, END\_ELEMENT - This preserves
parsing equivalency of empty element to .
This method will throw an IllegalStateException if it is called after hasNext() returns false.
**Returns:**
- the integer code corresponding to the current parse event
---
### nextTag()
- nextTag(): [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
- : Skips any white space (isWhiteSpace() returns true), COMMENT,
or PROCESSING\_INSTRUCTION,
until a START\_ELEMENT or END\_ELEMENT is reached.
If other than white space characters, COMMENT, PROCESSING\_INSTRUCTION, START\_ELEMENT, END\_ELEMENT
are encountered, an exception is thrown. This method should
be used when processing element-only content separated by white space.
Precondition: none
Postcondition: the current event is START\_ELEMENT or END\_ELEMENT
and cursor may have moved over any whitespace event.
Essentially it does the following (implementations are free to optimized
but must do equivalent processing):
```
int eventType = next();
while ( (eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace() )
|| (eventType == XMLStreamConstants.CDATA && isWhiteSpace())
|| eventType == XMLStreamConstants.SPACE
|| eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
|| eventType == XMLStreamConstants.COMMENT )
{
eventType = next();
}
if ( eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT )
{
throw new String XMLStreamException( "expected start or end tag", getLocation() );
}
return eventType;
```
**Returns:**
- the event type of the element read (START\_ELEMENT or END\_ELEMENT)
---
### readElementText()
- readElementText(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Reads the content of a text-only element, an exception is thrown if this is not a text-only element. This method
always returns coalesced content.
Precondition: the current event is START\_ELEMENT.
Postcondition: the current event is the corresponding END\_ELEMENT.
The method does the following (implementations are free to be optimized but must do equivalent processing):
```
if ( getEventType() != XMLStreamConstants.START_ELEMENT )
{
throw new XMLStreamException( "parser must be on START_ELEMENT to read next text", getLocation() );
}
int eventType = next();
StringBuffer content = new StringBuffer();
while ( eventType != XMLStreamConstants.END_ELEMENT )
{
if ( eventType == XMLStreamConstants.CHARACTERS || eventType == XMLStreamConstants.CDATA
|| eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.ENTITY_REFERENCE )
{
buf.append( getText() );
}
else if ( eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT )
{
// skipping
}
else if ( eventType == XMLStreamConstants.END_DOCUMENT )
{
throw new XMLStreamException( "unexpected end of document when reading element text content", this );
}
else if ( eventType == XMLStreamConstants.START_ELEMENT )
{
throw new XMLStreamException( "element text content may not contain START_ELEMENT", getLocation() );
}
else
{
throw new XMLStreamException( "Unexpected event type " + eventType, getLocation() );
}
eventType = next();
}
return buf.toString();
```
---
### readXMLObject()
- readXMLObject(): [Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- : Reads a sub-tree of the XML document and parses it as XML object.
The stream must be positioned on a START\_ELEMENT. Do not call the method
when the stream is positioned at document's root element. This would
cause the whole document to be parsed into a single XML what may lead to
an out-of-memory condition. Instead use \#next() to navigate to
sub-elements and invoke getXMLObject() there. Do not keep references to
more than the currently processed XML to keep memory consumption low. The
method reads the stream up to the matching END\_ELEMENT. When the method
returns the current event is the END\_ELEMENT event.
---
### require(Number, String, String)
- require(type: [Number](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Test if the current event is of the given type and if the namespace and name match the current
namespace and name of the current event. If the namespaceURI is null it is not checked for equality,
if the localName is null it is not checked for equality.
**Parameters:**
- type - the event type
- namespaceURI - the uri of the event, may be null
- localName - the localName of the event, may be null
---
### standaloneSet()
- standaloneSet(): [Boolean](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
- : Identifies if standalone was set in the document.
**Returns:**
- true if standalone was set in the document, false otherwise.
---
# Class XMLStreamWriter
- [TopLevel.Object](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
- [dw.io.XMLStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md)
The XMLStreamWriter can be used to write small and large XML feeds.
**Note:** when this class is used with sensitive data, be careful in persisting sensitive information to disk.
The XMLStreamWriter does not perform well-formedness checking on its input.
However the writeCharacters method escapes '&' , '<' and '>'. For attribute
values the writeAttribute method escapes the above characters plus '"' to
ensure that all character content and attribute values are well formed.
The following example illustrates how to use this class:
```
var fileWriter : FileWriter = new FileWriter(file, "UTF-8");
var xsw : XMLStreamWriter = new XMLStreamWriter(fileWriter);
xsw.writeStartDocument();
xsw.writeStartElement("products");
xsw.writeStartElement("product");
xsw.writeAttribute("id", "p42");
xsw.writeStartElement("name");
xsw.writeCharacters("blue t-shirt");
xsw.writeEndElement();
xsw.writeStartElement("rating");
xsw.writeCharacters("2.0");
xsw.writeEndElement();
xsw.writeEndElement();
xsw.writeEndElement();
xsw.writeEndDocument();
xsw.close();
fileWriter.close();
```
The code above will write the following to file:
```
a blue t-shirt
2.0
```
Note: This output has been formatted for readability. See
[XMLIndentingStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLIndentingStreamWriter.md).
## All Known Subclasses
[XMLIndentingStreamWriter](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLIndentingStreamWriter.md)
## Property Summary
| Property | Description |
| --- | --- |
| [defaultNamespace](#defaultnamespace): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) | Returns the current default name space. |
## Constructor Summary
| Constructor | Description |
| --- | --- |
| [XMLStreamWriter](#xmlstreamwriterwriter)([Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md)) | Constructs the XMLStreamWriter for a writer. |
## Method Summary
| Method | Description |
| --- | --- |
| [close](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#close)() | Close this writer and free any resources associated with the writer. |
| [flush](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#flush)() | Write any cached data to the underlying output mechanism. |
| [getDefaultNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#getdefaultnamespace)() | Returns the current default name space. |
| [getPrefix](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#getprefixstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Gets the prefix the URI is bound to. |
| [setDefaultNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#setdefaultnamespacestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Binds a URI to the default namespace. |
| [setPrefix](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#setprefixstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Sets the prefix the uri is bound to. |
| [writeAttribute](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeattributestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes an attribute to the output stream without a prefix. |
| [writeAttribute](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeattributestring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes an attribute to the output stream. |
| [writeAttribute](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeattributestring-string-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes an attribute to the output stream. |
| [writeCData](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writecdatastring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes a CData section. |
| [writeCharacters](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writecharactersstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Write text to the output. |
| [writeComment](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writecommentstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes an XML comment with the data enclosed. |
| [writeDTD](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writedtdstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Write a DTD section. |
| [writeDefaultNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writedefaultnamespacestring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes the default namespace to the stream. |
| [writeEmptyElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeemptyelementstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes an empty element tag to the output. |
| [writeEmptyElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeemptyelementstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes an empty element tag to the output. |
| [writeEmptyElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeemptyelementstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes an empty element tag to the output. |
| [writeEndDocument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeenddocument)() | Closes any start tags and writes corresponding end tags. |
| [writeEndElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeendelement)() | Writes an end tag to the output relying on the internal state of the writer to determine the prefix and local name of the event. |
| [writeEntityRef](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeentityrefstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes an entity reference. |
| [writeNamespace](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writenamespacestring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes a namespace to the output stream. |
| [writeProcessingInstruction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeprocessinginstructionstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes a processing instruction. |
| [writeProcessingInstruction](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writeprocessinginstructionstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes a processing instruction. |
| [writeRaw](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writerawstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes the given string directly into the output stream. |
| [writeStartDocument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartdocument)() | Write the XML Declaration. |
| [writeStartDocument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartdocumentstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Write the XML Declaration. |
| [writeStartDocument](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartdocumentstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Write the XML Declaration. |
| [writeStartElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartelementstring)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes a start tag to the output. |
| [writeStartElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartelementstring-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes a start tag to the output. |
| [writeStartElement](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.XMLStreamWriter.md#writestartelementstring-string-string)([String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Writes a start tag to the output. |
### Methods inherited from class Object
[assign](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)
## Property Details
### defaultNamespace
- defaultNamespace: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the current default name space.
---
## Constructor Details
### XMLStreamWriter(Writer)
- XMLStreamWriter(writer: [Writer](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.io.Writer.md))
- : Constructs the XMLStreamWriter for a writer.
**Parameters:**
- writer - the writer for which the XMLStreamWriter is constructed.
---
## Method Details
### close()
- close(): void
- : Close this writer and free any resources associated with the
writer. This method does not close the underlying writer.
---
### flush()
- flush(): void
- : Write any cached data to the underlying output mechanism.
---
### getDefaultNamespace()
- getDefaultNamespace(): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Returns the current default name space.
**Returns:**
- the current default name space.
---
### getPrefix(String)
- getPrefix(uri: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
- : Gets the prefix the URI is bound to.
**Parameters:**
- uri - the URI to use.
**Returns:**
- the prefix or null.
---
### setDefaultNamespace(String)
- setDefaultNamespace(uri: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Binds a URI to the default namespace.
This URI is bound
in the scope of the current START\_ELEMENT / END\_ELEMENT pair.
If this method is called before a START\_ELEMENT has been written
the uri is bound in the root scope.
**Parameters:**
- uri - the uri to bind to the default namespace, may be null.
---
### setPrefix(String, String)
- setPrefix(prefix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), uri: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Sets the prefix the uri is bound to. This prefix is bound
in the scope of the current START\_ELEMENT / END\_ELEMENT pair.
If this method is called before a START\_ELEMENT has been written
the prefix is bound in the root scope.
**Parameters:**
- prefix - the prefix to bind to the uri, may not be null.
- uri - the uri to bind to the prefix, may be null.
---
### writeAttribute(String, String)
- writeAttribute(localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes an attribute to the output stream without
a prefix.
**Parameters:**
- localName - the local name of the attribute.
- value - the value of the attribute.
---
### writeAttribute(String, String, String)
- writeAttribute(namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes an attribute to the output stream.
**Parameters:**
- namespaceURI - the uri of the prefix for this attribute.
- localName - the local name of the attribute.
- value - the value of the attribute.
---
### writeAttribute(String, String, String, String)
- writeAttribute(prefix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), value: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes an attribute to the output stream.
**Parameters:**
- prefix - the prefix for this attribute.
- namespaceURI - the uri of the prefix for this attribute.
- localName - the local name of the attribute.
- value - the value of the attribute.
---
### writeCData(String)
- writeCData(data: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes a CData section.
**Parameters:**
- data - the data contained in the CData Section, may not be null.
---
### writeCharacters(String)
- writeCharacters(text: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Write text to the output.
**Parameters:**
- text - the value to write.
---
### writeComment(String)
- writeComment(data: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes an XML comment with the data enclosed.
**Parameters:**
- data - the data contained in the comment, may be null.
---
### writeDTD(String)
- writeDTD(dtd: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Write a DTD section. This string represents the entire doctypedecl production
from the XML 1.0 specification.
**Parameters:**
- dtd - the DTD to be written.
---
### writeDefaultNamespace(String)
- writeDefaultNamespace(namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes the default namespace to the stream.
**Parameters:**
- namespaceURI - the uri to bind the default namespace to.
---
### writeEmptyElement(String)
- writeEmptyElement(localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes an empty element tag to the output.
**Parameters:**
- localName - local name of the tag, may not be null.
---
### writeEmptyElement(String, String)
- writeEmptyElement(namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes an empty element tag to the output.
**Parameters:**
- namespaceURI - the uri to bind the tag to, may not be null.
- localName - local name of the tag, may not be null.
---
### writeEmptyElement(String, String, String)
- writeEmptyElement(prefix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes an empty element tag to the output.
**Parameters:**
- prefix - the prefix of the tag, may not be null.
- localName - local name of the tag, may not be null.
- namespaceURI - the uri to bind the tag to, may not be null.
---
### writeEndDocument()
- writeEndDocument(): void
- : Closes any start tags and writes corresponding end tags.
---
### writeEndElement()
- writeEndElement(): void
- : Writes an end tag to the output relying on the internal
state of the writer to determine the prefix and local name
of the event.
---
### writeEntityRef(String)
- writeEntityRef(name: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes an entity reference.
**Parameters:**
- name - the name of the entity.
---
### writeNamespace(String, String)
- writeNamespace(prefix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes a namespace to the output stream.
If the prefix argument to this method is the empty string,
"xmlns", or null this method will delegate to writeDefaultNamespace.
**Parameters:**
- prefix - the prefix to bind this namespace to.
- namespaceURI - the uri to bind the prefix to.
---
### writeProcessingInstruction(String)
- writeProcessingInstruction(target: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes a processing instruction.
**Parameters:**
- target - the target of the processing instruction, may not be null.
---
### writeProcessingInstruction(String, String)
- writeProcessingInstruction(target: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), data: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes a processing instruction.
**Parameters:**
- target - the target of the processing instruction, may not be null.
- data - the data contained in the processing instruction, may not be null.
---
### writeRaw(String)
- writeRaw(raw: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes the given string directly into the output stream. No checks
regarding the correctness of the XML are done. The caller must ensure
that the final result is a correct XML.
**Parameters:**
- raw - the string to write to the output stream.
---
### writeStartDocument()
- writeStartDocument(): void
- : Write the XML Declaration. Defaults the XML version to 1.0, and the encoding to utf-8
---
### writeStartDocument(String)
- writeStartDocument(version: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Write the XML Declaration. Defaults the XML version to 1.0
**Parameters:**
- version - version of the xml document.
---
### writeStartDocument(String, String)
- writeStartDocument(encoding: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), version: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Write the XML Declaration. Note that the encoding parameter does
not set the actual encoding of the underlying output. That must
be set when the instance of the XMLStreamWriter is created using the
XMLOutputFactory.
**Parameters:**
- encoding - encoding of the xml declaration.
- version - version of the xml document.
---
### writeStartElement(String)
- writeStartElement(localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes a start tag to the output. All writeStartElement methods
open a new scope in the internal namespace context. Writing the
corresponding EndElement causes the scope to be closed.
**Parameters:**
- localName - local name of the tag, may not be null.
---
### writeStartElement(String, String)
- writeStartElement(namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes a start tag to the output.
**Parameters:**
- namespaceURI - the namespaceURI of the prefix to use, may not be null.
- localName - local name of the tag, may not be null.
---
### writeStartElement(String, String, String)
- writeStartElement(prefix: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), localName: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), namespaceURI: [String](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): void
- : Writes a start tag to the output.
**Parameters:**
- prefix - the prefix of the tag, may not be null.
- localName - local name of the tag, may not be null.
- namespaceURI - the uri to bind the prefix to, may not be null.
---
# Client IP Forwarding
Forwarding Client IPs to the B2C Commerce platform is a prerequisite for services such as geolocation. You can use any of the following options to pass shopper client IPs to the B2C Commerce platform.
In Custom API implementations and hooks, access the client IP using the Script API method [Request.getRemoteAddress()](https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/current/scriptapi/html/api/class_dw_system_Request.html#dw_system_Request_getHttpRemoteAddress_DetailAnchor).
**note:** This method only works correctly if one of the following options (either Shopper Context or Request Header) is implemented.
## Shopper Context
You can use the [Shopper Context API](https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-context?meta=Summary) API to pass a client IP to the B2C Commerce Platform. The [client IP can be stored](https://developer.salesforce.com/docs/commerce/commerce-api/guide/shopper-context-geolocation.html#retrieve-geolocation-with-client-ip-address-and-use-for-subsequent-requests) in the shopper profile and used in subsequent requests.
## Request Header
In **Business Manager > {Your-Site} >** **Merchant Tools** > **SEO** > **Customer CDN Settings**, in the **Dynamic Content** section, configure the _Client IP Header Name_ field. For each request the B2C Commerce API will use this setting to retrieve the client IP address from the request header instead of the CDN network connection source address. If the request header isn't provided, the CDN connection source address will be used.
**note:** - If both options are used, Shopper Context takes precedence.
# Client-Side Payment Processing Flow
With client-side payment processing, you create a checkout UI component that interacts directly with a payment provider. You also implement a payment adapter that independently validates transactions.
Create your store and configure checkout before you set up your payment system.
**note:** Among the benefits of the client-side integration model is PCI compliance and security. Isolating the handling of sensitive payment data in a cross-domain UI component owned by the payment provider means much of the PCI burden is on the provider.
Similar to a server side integration, a client side integration requires creating a PaymentGatewayAdapter but with these differences:
- The adapter implements a PostAuth request to validate the transaction. The PostAuth request type ensures that the provided payment authorization token is valid. The client calls the Checkout Payment API with the requestType PostAuth, which in turn invokes the adapter with a commercepayments.PostAuthorizationRequest. That request provides the adapter with the amount, currency code, and payment token. The adapter can then use this data to validate the transaction and provide a response..
- A custom Checkout UI component (which may wrap or adapt a payment provider component).
- A server-side call to fetch keys or configurations required to load the Checkout UI component. You use a standard Salesforce Apex Controller to bootstrap the client component.
A payment provider client typically manages the authorization and tokenization functions. In that case, the [Commerce Payment Connect APIs](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_payments.htm) required for client-side implementation are:
- Capture
- ReferencedRefund
- AuthorizationReversal
- PostAuth
The diagram depicts a high level view of a typical client-side integration.
When a shopper clicks Place Order:
1. a. The Client Payment Controller initiates a payment transaction with the Payment Apex Controller and 1. b. The Payment Apex Controller initiates a transaction with the Payment Gateway.
2. The Client posts an authenticated and tokenized transaction to the Payment Gateway This is the client-to-gateway transaction that gives client side payments its name. Typically this is done with payment provider-built UI components.
3. a. The UI client component calls the Checkout payment API with a requestType of PostAuth to validate the transaction and 3. b. The Apex Payment Adapter processes the PostAuth request, fetching the transaction details - including currency code, amount and account ID - from the gateway for verification. (See [ConnectApi.PostAuthorizeRequest](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_post_auth.htm). ) The Apex implementation then returns the gateway auth code, gateway result code, Salesforce result code and the amount. If the payment is asynchronous and can’t be fully confirmed at 3. b, see [Create a Custom Payment Component](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-integrate-payment-lwc.md).
4. In an asynchronous implementation, the Payment Gateway issues a web hook notification to affirm the transaction.
To implement client-side payment processing, see
- [Create a Custom Payment Component](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-integrate-payment-lwc.md)
- [Customize a Checkout Component](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-create-checkout-component.md)
- [Payment Gateway Adapters](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_commercepayments_adapter_intro.htm)
- [Connect a Payment Gateway to Store Checkout](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-checkout-connect-gateway.md)
**See Also**
- [_Apex Reference Guide_: Payment Gateway Adapters](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_commercepayments_adapter_intro.htm)
Clienteling SPI
# Clienteling SPI
[Download specification](https://developer.salesforce.com/static/commercecloud/retail-cloud/clienteling-spi/clienteling-spi-oas-public.yaml)
Merchant SPI to create, search, and retrieve customers from the merchant's system. These are sample endpoints that provide specifications for merchants on how to implement APIs on their end and then configure them in Point of Sale (POS) CMS for the POS to use during clienteling operations. For more information, see [Point of Sale API, SPI, and Webhook Overview](https://developer.salesforce.com/docs/commerce/retail-cloud/guide/retail-cloud-api-spi-webhook-specs.html)
**Version:** 2.3.4
## Tags
### Clienteling SPI
[Download specification](https://developer.salesforce.com/static/commercecloud/retail-cloud/clienteling-spi/clienteling-spi-oas-public.yaml)
Merchant SPI to create, search, and retrieve customers from the merchant's system. These are sample endpoints that provide specifications for merchants on how to implement APIs on their end and then configure them in Point of Sale (POS) CMS for the POS to use during clienteling operations. For more information, see [Point of Sale API, SPI, and Webhook Overview](https://developer.salesforce.com/docs/commerce/retail-cloud/guide/retail-cloud-api-spi-webhook-specs.html)
## Operations
### GET Search and retrieve customers.
`GET /merchant/spi/sample/endpoint/sa/customers`
Operation ID: `searchCustomers`. Tags: Clienteling SPI.
Search and retrieve customers based on input parameters. Merchant must implement this endpoint per this specification and then configure it in CMS. For more information, see [Point of Sale API, SPI, and Webhook Overview](https://developer.salesforce.com/docs/commerce/retail-cloud/guide/retail-cloud-api-spi-webhook-specs.html)
#### Parameters
* `start` (query, integer (int32))
Default: `0`.
* `count` (query, integer (int32))
Default: `20`.
* `firstName` (query, string)
* `lastName` (query, string)
* `phone` (query, string)
* `email` (query, string)
* `id` (query, string)
* `postalCode` (query, string)
* `searchString` (query, string)
* `countryCode` (query, string)
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `SearchCustomersResponse`.
### PUT Update customer.
`PUT /merchant/spi/sample/endpoint/sa/customers`
Operation ID: `updateCustomer`. Tags: Clienteling SPI.
Update the existing customer. The existing customerId is provided under 'profile.customerId'. Merchant must implement this endpoint per this specification and then configure it in CMS. For more information, see [Point of Sale API, SPI, and Webhook Overview](https://developer.salesforce.com/docs/commerce/retail-cloud/guide/retail-cloud-api-spi-webhook-specs.html)
#### Request body
Media type: `application/json`. Schema: `UpdateCustomerRequest`.
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `UpdateCustomerResponse`.
### POST Create customer.
`POST /merchant/spi/sample/endpoint/sa/customers`
Operation ID: `createCustomer`. Tags: Clienteling SPI.
Create customer based on customer data entered in POS. Merchant must implement this endpoint per this specification and then configure it in CMS. For more information, see [Point of Sale API, SPI, and Webhook Overview](https://developer.salesforce.com/docs/commerce/retail-cloud/guide/retail-cloud-api-spi-webhook-specs.html)
#### Request body
Media type: `application/json`. Schema: `CreateCustomerRequest`.
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `CreateCustomerResponse`.
### GET Retrieve customer details.
`GET /merchant/spi/sample/endpoint/sa/customers/{customerId}`
Operation ID: `getCustomer`. Tags: Clienteling SPI.
Retrieve customer data based on customer ID. Merchant must implement this endpoint per this specification and then configure it in CMS. For more information, see [Point of Sale API, SPI, and Webhook Overview](https://developer.salesforce.com/docs/commerce/retail-cloud/guide/retail-cloud-api-spi-webhook-specs.html)
#### Parameters
* `customerId` (path, string, required)
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `GetCustomerResponse`.
## Schemas
### SearchCustomersResponse
* `errorMessage` (_string_, nullable) Error message shown to the user.
Example: `Invalid request. Please check the request and try again.`.
* `errorCode` (_string_, nullable) Error code shown to the user.
Example: `INTERNAL_ERROR`.
* `customers` (_array of CustomerData_, nullable) List of Customers.
* `associateSessionId` (_string_, nullable) Store associate session ID.
* `error` (_boolean_)
### UpdateCustomerRequest
* `profile` (_Profile_, required)
* `addressList` (_array of Address_, nullable, deprecated) Deprecated. Not supported in create or update customer requests. Use profile.address instead. To add additional addresses, use the Customer Address SPI (CREATE\_CUSTOMER\_ADDRESS or UPDATE\_CUSTOMER\_ADDRESS). The complete address collection is returned in responses only.
* `consents` (_Consents_)
* `storeAttribution` (_SpiStoreAttribution_)
* `loyaltyProfile` (_CustomerLoyaltyProfile_)
### UpdateCustomerResponse
* `errorMessage` (_string_, nullable) Error message shown to the user.
Example: `Invalid request. Please check the request and try again.`.
* `errorCode` (_string_, nullable) Error code shown to the user.
Example: `INTERNAL_ERROR`.
* `profile` (_Profile_, required)
* `addressList` (_array of Address_, nullable) List of all customer addresses. In responses returned to POS from the merchant system, contains the complete address collection, including the primary address from profile.address.
* `loyaltyProfile` (_CustomerLoyaltyProfile_)
* `consents` (_Consents_)
* `error` (_boolean_)
### CreateCustomerRequest
* `profile` (_Profile_, required)
* `addressList` (_array of Address_, nullable, deprecated) Deprecated. Not supported in create or update customer requests. Use profile.address instead. To add additional addresses, use the Customer Address SPI (CREATE\_CUSTOMER\_ADDRESS or UPDATE\_CUSTOMER\_ADDRESS). The complete address collection is returned in responses only.
* `consents` (_Consents_)
* `storeAttribution` (_SpiStoreAttribution_)
### CreateCustomerResponse
* `errorMessage` (_string_, nullable) Error message shown to the user.
Example: `Invalid request. Please check the request and try again.`.
* `errorCode` (_string_, nullable) Error code shown to the user.
Example: `INTERNAL_ERROR`.
* `profile` (_Profile_, required)
* `addressList` (_array of Address_, nullable) List of all customer addresses. In responses returned to POS from the merchant system, contains the complete address collection, including the primary address from profile.address.
* `loyaltyProfile` (_CustomerLoyaltyProfile_)
* `consents` (_Consents_)
* `error` (_boolean_)
### GetCustomerResponse
* `errorMessage` (_string_, nullable) Error message shown to the user.
Example: `Invalid request. Please check the request and try again.`.
* `errorCode` (_string_, nullable) Error code shown to the user.
Example: `INTERNAL_ERROR`.
* `sessionId` (_string_) Active session ID.
* `profile` (_Profile_, required)
* `addressList` (_array of Address_, nullable) List of all customer addresses. In responses returned to POS from the merchant system: contains the complete address collection, including the primary address from profile.address.
* `cartProductList` (_array of ClientelingCartProduct_, nullable) List of products saved in customer cart.
* `loyaltyProfile` (_CustomerLoyaltyProfile_)
* `consents` (_Consents_)
* `error` (_boolean_)
### CustomerData
List of Customers.
* `profile` (_Profile_, required)
* `addressList` (_array of Address_) Customer's addresses.
* `cartProductList` (_array of ClientelingCartProduct_) Wish list or products from customer's abandoned cart.
* `loyaltyProfile` (_CustomerLoyaltyProfile_)
* `consents` (_Consents_)
### Profile
Customer profile. In case of sale and return transactions, it is mandatory if a signed-in customer places an order or a return. Note: If an order is imported from an external system into POS, only customerId and alternateCustomerId from the profile object are used.
* `customerId` (_string_, nullable) Customer ID. Optional for guest customer. Mandatory for logged-in customer.
* `alternateCustomerId` (_string_, nullable) Alternate Customer ID.
* `email` (_string_, nullable) Customer Email ID.
Optional for guest customer. Mandatory for logged-in customer.
* `salutation` (_string_, nullable) Salutation.
* `firstName` (_string_, nullable) Customer first name
Optional for guest customer. Mandatory for logged-in customer.
* `secondName` (_string_, nullable) Customer second name.
* `lastName` (_string_, nullable) Customer last name
Optional for guest customer. Mandatory for logged-in customer.
* `suffix` (_string_, nullable) Suffix.
* `address` (_object_) Customer address. In requests sent from POS to the merchant system: accepts any customer address (primary, secondary, or other). In responses returned to POS from the merchant system: contains the customer's primary address.
Includes all fields of `Address`.
* `phoneHome` (_string_, nullable) Phone Home.
* `phoneMobile` (_string_, nullable) Phone Mobile. This is the primary phone number for the customer.
* `phoneBusiness` (_string_, nullable) Phone Business.
* `fax` (_string_, nullable) Fax.
* `birthmonth` (_string_, nullable) Customer birth month. Not applicable for order related scenarios like export/import.
* `wallets` (_array of Wallet_, nullable) Customer wallets containing tokenized cards for Card on File payments.
Optional field returned only when customer has stored cards.
* `eReceipt` (_boolean_, nullable) Customer eReceipt indicator. Not applicable for order related scenarios like export/import.
* `country` (_string_, nullable) Country.
* `customerGroup` (_string_, nullable) Customer group. Not applicable for order related scenarios like export/import.
* `preferredLanguage` (_string_, nullable) Preferred language. Not applicable for order related scenarios like export/import.
* `allowSmsNotifications` (_boolean_, nullable) SMS sign up checkbox. Not applicable for order related scenarios like export/import.
* `loyaltyId` (_string_, nullable) Loyalty Id of the customer.
* `logoUrl` (_string_, nullable) The URL for the logo to be displayed for loyalty customers. Not applicable for order related scenarios like export/import.
### Address
Address **Billing Address:** It contains first and last name of billing person. It is applicable if order is associated with signed-in customer or if an order requires billing address. Note: If item level shipping method or item level shipping address is enabled, use the shippingAddress from deliveryGroups. For more details, see:.
* `salutation` (_string_, nullable) Salutation.
* `firstName` (_string_) Customer first name saved for address.
Maximum length: 64.
* `secondName` (_string_, nullable) Customer second name saved for address.
Maximum length: 64.
* `lastName` (_string_, nullable) Customer last name saved for address.
Maximum length: 64.
* `suffix` (_string_, nullable) Suffix.
* `addressLine1` (_string_, required) Address Line 1.
Maximum length: 256.
* `addressLine2` (_string_, nullable) Address Line 2.
Maximum length: 256.
* `city` (_string_, required) City.
Maximum length: 64.
* `state` (_string_, required) State.
Maximum length: 32.
* `postalCode` (_string_, required) Postal Code.
Maximum length: 16.
* `countryCode` (_string_, nullable) Country Code.
Maximum length: 32.
* `phone` (_string_, nullable) Phone.
Maximum length: 24.
* `storeId` (_string_, nullable) Store ID if it is store address.
* `emailAddress` (_string_, nullable) Customer Email Address.
* `country` (_string_, nullable) Country.
* `defaultBilling` (_boolean_)
* `defaultShipping` (_boolean_)
### Consents
Consents for different types of sign ups.
* `smsSignUp` (_boolean_, nullable) Consent for SMS signup.
* `newsLetterSignUp` (_boolean_, nullable) Consent for news letter signup.
* `agreeToTC` (_boolean_, nullable) Consent for terms and conditions.
* `directMailSignUp` (_boolean_, nullable) Consent for direct mail signup.
* `phoneSignUp` (_boolean_, nullable) Consent for phone signup.
* `loyaltySignUp` (_boolean_, nullable) Consent for loyalty signup.
* `eReceipt` (_boolean_, nullable) Consent for eReceipt signup.
### SpiStoreAttribution
Store ID and associate details of created customer.
* `storeAssociateId` (_string_, nullable) ID of the store associate who creates customer account and rings the transaction.
* `storeId` (_string_, nullable) Store Id.
### CustomerLoyaltyProfile
The loyalty profile of the customer if they are enrolled in Loyalty program.
* `loyaltyId` (_string_) Loyalty Id of the customer.
* `firstName` (_string_) Customer's first name.
* `lastName` (_string_) Customer's last name.
* `accountNumber` (_string_) Customer's loyalty account number.
* `loyaltyStatusCode` (_string_, nullable) Customer's loyalty status code.
* `currentPoints` (_integer (int32)_, nullable) Customer's current loyalty points. If provided, it will be used for validation against the individual reward points (If points are sent in reward).
* `currentStoreCredit` (_number (double)_, nullable) Customer's current store credit.
* `lifetimePoints` (_integer (int32)_, nullable) Loyalty point accumulated so far by the customer.
* `nextRewardPoints` (_integer (int32)_, nullable) Loyalty point eligible for next reward cycle.
* `transactions` (_Transactions_)
* `rewards` (_array of Reward_, nullable) Earned rewards.
* `tierLevelLabel` (_string_, nullable) Customer's tier level label.
* `tierLevelValue` (_string_, nullable) Customer's tier level value.
* `tierLevelCode` (_string_, nullable) Customer's tier level code.
* `redemptionType` (_string_)
* `internalMemberId` (_string_, nullable) Customer's internal member ID.
* `homePhoneNumber` (_string_, nullable) Customer's home phone number.
* `mobilePhoneNumber` (_string_, nullable) Customer's mobile phone number.
* `address` (_Address_)
* `currentTier` (_Tier_)
* `nextTier` (_Tier_)
* `customLoyaltyAttributes` (_CustomAttributes_)
* `totalRewardsAmount` (_number_, nullable) Total amount value of all the rewards available for the customer. If provided, this will be used for validation when applying the individual rewards.
* `loyaltyIdBarCodeType` (_string_)
### ClientelingCartProduct
Summary of a product line in the customer's saved cart. Current implementation only supports productId as the details are fetched from the product catalog.
* `productId` (_string_, required) Product / SKU identifier of the product.
### Wallet
Tokenized card stored in customer wallet for Card on File payments.
* `firstName` (_string_) Cardholder's first name as shown on the payment card, used for ID verification.
* `secondName` (_string_, nullable) Cardholder's middle name or additional given name, if present.
* `lastName` (_string_) Cardholder's last name as shown on the payment card, used for ID verification.
* `program` (_string_, required) Program identifier, for example, 'CB' for Crate & Barrel.
Example: `CB`.
* `shopperReference` (_string_, required) Payment method ID from payment gateway (shopper reference).
Example: `336df316-56b3-430c-a366-ea5e8d694582`.
* `storedPaymentMethodId` (_string_, required) Card identifier from card issuer (stored payment method ID).
Example: `xyz12345677777`.
* `cardAlias` (_string_, required) Identifier of the stored card.
Example: `xyz12345677777`.
* `status` (_string_, required) Status of the wallet card.
Allowed values: `Active`, `Inactive`. Example: `Active`.
* `type` (_string_, required) Type of the wallet card.
Allowed values: `Virtual`, `Physical`. Example: `Virtual`.
* `cardType` (_string_, required) Card network, for example, Visa, Mastercard, or Amex.
Example: `Visa`.
* `cardLastFour` (_string_, required) Last 4 digits of the card number.
Example: `1111`.
### Transactions
Loyalty transactions.
* `nextStartMonth` (_integer (int32)_)
* `txnActivity` (_array of TransactionActivity_)
### Reward
Earned rewards.
* `issueDate` (_integer (int64)_)
* `expiryDate` (_integer (int64)_)
* `description` (_string_)
* `amount` (_number_) Amount value of the reward. Required for reward types : Discount and Tender.
* `rewardName` (_string_)
* `code` (_string_)
* `pin` (_string_)
* `codeType` (_string_)
* `labelText` (_string_)
* `disclaimerText` (_string_)
* `rewardType` (_string_)
Allowed values: `Discount`, `Coupon`, `Tender`.
* `isImageOnly` (_boolean_)
* `rewardImageURL` (_string_)
* `rewardInputType` (_string_)
* `status` (_string_)
Allowed values: `REDEEMED`, `EXPIRED`, `AVAILABLE`, `CANCELLED`.
* `statusDesc` (_string_)
* `canRedeemNow` (_boolean_)
* `redeemedDate` (_integer (int64)_)
* `customAttributes` (_object_)
Additional properties: `object`.
* `rewardId` (_string_, required, read-only) The ID of the loyalty reward. In the case of reward coupon,
it will be coupon code. In the case of discount reward, it is unique identifier.
Maximum length: 512.
* `combinable` (_boolean_) Specifies whether multiple rewards can be applied to the same cart.
* `points` (_integer (int32)_, nullable) Optional points value for the reward, if sent, it will be used for display and for validation against the current points of the customer ( loyaltyProfile.currentPoints).
### Tier
Customer's next tier details.
* `name` (_string_) Tier name.
* `minPoints` (_number_) Minimum points required for the tier.
* `display` (_string_)
* `points` (_integer (int32)_)
* `memberSince` (_integer (int64)_) Member since, of this tier.
* `title` (_string_)
* `subTitle` (_string_)
* `imageUrl` (_string_)
* `expiryDate` (_integer (int64)_) Expiry date of the customer's membership.
### CustomAttributes
Custom attributes.
* `customLabel` (_string_)
* `customValues` (_array of CustomValue_)
### TransactionActivity
* `orderId` (_string_)
* `date` (_integer (int64)_)
* `description` (_string_)
* `points` (_integer (int32)_)
* `amount` (_number_)
* `pointStatus` (_string_)
Allowed values: `EARNED`, `PENDING`, `REWARD`, `REDEEMED`.
* `customAttributes` (_object_)
Additional properties: `object`.
### CustomValue
* `laabel` (_string_)
* `value` (_string_)
* `iconType` (_string_)
# Clienteling SPI Field Mapping
Use the Clienteling SPI to create, search, update, and retrieve details of a specific customer. This guide summarizes how Clienteling SPI fields map to customer-related information tags. For specification details, see [Clienteling SPI](https://developer.salesforce.com/docs/commerce/retail-cloud/references/clienteling-spi?meta=Summary).
For more information on tags, read PS Tags.
| **PS Tag on Layout** | **Backend SPI Field** | **CMS Grouping** |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| :ps_salutation | profile.salutation | User Profile |
| :ps_customer_name | profile.firstName & profile.lastName | User Profile |
| :ps_first_name | profile.firstName | User Profile |
| :ps_last_name | profile.lastName | User Profile |
| :ps_email | profile.email | User Profile |
| :ps_gender | profile.gender | User Profile |
| :ps_customer_phone | profile.phoneMobile | User Profile |
| :ps_profile_home_phone_number | profile.phoneHome **Note:** "If configuring this field on any clienteling layouts, the "profile.phoneHome" field should be configured in NetSuite. Alternatively, you can map it to the **phone** attribute in NetSuite using "profile.phone". | User Profile |
| :ps_birthday | profile.birthday | User Profile |
| :ps_profile_city | profile.address.city | User Profile |
| :ps_profile_country_code | profile.address.countryCode | User Profile |
| :ps_profile_preferred_language | profile.preferredLanguage | User Profile |
| :ps_customer_tax_id | profile.taxInfo.taxId | User Profile |
| :ps_alternate_customer_id | profile.alternateCustomerId | User Profile |
| :ps_num_orders_completed | orderCount | User Profile |
| :ps_num_addresses | addressList | User Profile |
| :ps_num_orders_placed | orderList | User Profile |
| :ps_num_payment_cards | cardList | User Profile |
| :ps_num_wishlist_products | products | User Profile |
| :ps_profile_addressline1 | profile.address.addressLine1 | User Profile |
| :ps_profile_addressline2 | profile.address.addressLine2 | User Profile |
| :ps_profile_city | profile.address.city | User Profile |
| :ps_profile_state | profile.address.state | User Profile |
| :ps_profile_zip | profile.address.postalCode | User Profile |
| :ps_profile_country | profile.address.countryCode | User Profile |
| :ps_profile_address_phone_number | profile.phoneMobile | User Profile |
| consents.newsLetterSignUp | consents.newsLetterSignUp | Form Field |
| consents.eReceipt | consents.eReceipt | Form Field |
| consents.smsSignUp | consents.smsSignUp | Form Field |
| consents.agreeToTC | consents.agreeToTC | Form Field |
| consents.directMailSignUp | consents.directMailSignUp | Form Field |
| consents.phoneSignUp | consents.phoneSignUp | Form Field |
| consents.loyaltySignUp | consents.loyaltySignUp | Form Field |
| :ps_total_store_credit | loyaltyProfile.currentStoreCredit | User Loyalty Profile |
| :ps_current_loyalty_tier_name | loyaltyProfile.currentTier.name | User Loyalty Profile |
| :ps_current_loyalty_tier_title | loyaltyProfile.currentTier.title | User Loyalty Profile |
| :ps_current_loyalty_tier_subtitle | loyaltyProfile.currentTier.subTitle | User Loyalty Profile |
| :ps_current_reward_points | loyaltyProfile.currentPoints | User Loyalty Profile |
| :ps_current_tier_date | loyaltyProfile.currentTier.memberSince | User Loyalty Profile |
| :ps_current_tier_expiry_date | loyaltyProfile.currentTier.expiryDate | User Loyalty Profile |
| :ps_current_loyalty_tier_display | loyaltyProfile.currentTier.display | User Loyalty Profile |
| :ps_next_loyalty_tier_display | loyaltyProfile.nextTier.display | User Loyalty Profile |
| :ps_next_loyalty_tier_name | loyaltyProfile.nextTier.name | User Loyalty Profile |
| :ps_next_loyalty_tier_title | loyaltyProfile.nextTier.title | User Loyalty Profile |
| :ps_total_points | loyaltyProfile.lifetimePoints | User Loyalty Profile |
| :ps_loyalty_custom | loyaltyProfile.customAttributes | User Loyalty Profile |
| :ps_account_number | loyaltyProfile.accountNumber | User Loyalty Profile |
| :ps_num_cash_rewards | loyaltyProfile.cashRewards | User Loyalty Profile |
| :ps_points_to_next_tier | loyaltyProfile.nextTier.points - loyaltyProfile.lifetimePoints | User Loyalty Profile |
| :ps_num_rewards | loyaltyProfile.rewards | User Loyalty Profile |
| :ps_current_credits | loyaltyProfile.currentStoreCredit | User Loyalty Profile |
| :ps_points_to_next_reward | loyaltyProfile.nextRewardPoints - loyaltyProfile.currentPoints | User Loyalty Profile |
| :ps_num_rewards_total | loyaltyProfile.rewards.amount | User Loyalty Profile |
| :ps_num_rewards_total_2 | Sum of loyaltyProfile.rewards[].amount and if loyaltyProfile.rewards.status | User Loyalty Profile |
| :ps_num_rewards_total_2_no_dec | Sum of loyaltyProfile.rewards[].amount and if loyaltyProfile.rewards.status = AVAILABLE | User Loyalty Profile |
| :ps_num_cash_rewards_total_no_dec | Sum of loyaltyProfile.cashRewards.amount if loyaltyProfile.cashRewards.status = AVAILABLE | User Loyalty Profile |
| :ps_num_cash_rewards_total | Sum of loyaltyProfile.cashRewards.amount | User Loyalty Profile |
| :ps_club_contact_id | loyaltyProfile.accountNumber OR loyaltyProfile.loyaltyId | Wine Loyalty |
| :ps_club_id | loyaltyProfile.tierLevelValue | Wine Loyalty |
| :ps_club_membership_id | loyaltyProfile.loyaltyId | Wine Loyalty |
| :ps_club_name | loyaltyProfile.currentTier.name | Wine Loyalty |
| :ps_profile_company | profile.companyName | Wine Loyalty |
| :ps_profile_title | loyaltyProfile.title | Wine Loyalty |
# Clienteling SPI for CRM
Implementing the Clienteling SPI allows merchants to use their own system as the system of record for managing customer profiles, configuring Point of Sale to create, update, search, and retrieve customer profiles from the merchant system. This approach provides an alternative to using one of our standard connectors to a CRM (for example, Agentforce Service or Netsuite).
The Clienteling SPI has three prerequisites:
1. Merchant builds the SPI service for the endpoints (that is, for each clienteling operation to be supported)
2. Merchant configures the connector in CMS, specifying the details of the integration between Retail Cloud and the SPI endpoint you’ve built
3. Merchant configures the layouts in CMS. Layouts allow you to define a custom form for the POS that will take associate inputs and pass them as parameters in requests to the SPI endpoint
The Clienteling SPI supports four endpoints. See [Clienteling SPI](https://developer.salesforce.com/docs/commerce/retail-cloud/references/clienteling-spi?meta=Summary) for detailed specifications for each endpoint.
| **Endpoint Name** | **Sample Endpoint** | **Method** | **Description** |
| ----------------- | ----------------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CREATE_CUSTOMER | /endpoint/sa/customers | POST | Create new customer profile based on customer data entered in POS. |
| UPDATE_CUSTOMER | /endpoint/sa/customers | PUT | Update existing customer by specifying values for the parameters passed. Customer parameters not provided in the request will be left unchanged. The specific customer to update is identified by customer ID. |
| SEARCH_CUSTOMERS | /endpoint/sa/customers | GET | Search and retrieve customers previously created based on input parameters passed from POS. |
| GET_CUSTOMER | /endpoint/sa/customers/{customerId} | GET | Retrieve customer data based on provided customer ID. |
## Clienteling SPI and Associate Journey
Merchants can define which customer attributes are passed from the POS to the Clienteling SPI, specifying only the data they wish to track and maintain. For each clienteling operation, the data the associate collects are determined by the fields configured on the corresponding layout.
To better understand the Clienteling SPI, let's consider each endpoint, the specific associate journey that invokes it, the layout used to capture the customer information, and the presentation of data from the SPI response in the POS app.
### Customer Search
When a store associate searches for a customer, whether to add them to the cart during checkout or to view their profile during clienteling activities, the associate’s inputs in the Customer Search layout are passed to the SEARCH_CUSTOMERS endpoint.
See the below example of a Customer Search layout, presented as a full-page form when the associate taps the clienteling CTA (the "person" icon) in the top right corner of the home screen. Results retrieved from the SEARCH_CUSTOMERS endpoint's response are presented in a list view below the search form.

Selecting one of the profiles in the list will login that customer. When a customer is logged in, the customer's first name and profile photo are shown in the top right corner of the home screen.

### Create Customer
When a store associate creates a new customer profile, the fields in the Customer Signup layout are passed in a request to the CREATE_CUSTOMER endpoint. See the below example of a Customer Signup layout. Associates typically will access this layout when searching for a customer and finding no results or during checkout if they have not already logged a customer in for the cart.

### Retrieve Customer Profile
After logging in a customer, the associate can view the customer’s profile, and, as needed, make edits to the profile, which result in calls to the GET_CUSTOMER and UPDATE_CUSTOMER endpoints, respectively. The *View profile* CTA in the below screenshot will take the associate to the customer's profile.

Below is an example of a Customer 360 layout, the customer's profile rendered with the details from the GET_CUSTOMER response. For more detail on setting up this layout, see: Understanding & Configuring Customer 360°.

### Update Customer Profile
An associate might update a customer's profile when acquiring new or updated information about a customer's preferences, location, contact details, and personal attributes. The Update Customer layout is typically a form with the same fields as the Customer Signup layout, pre-filled with the existing values against each customer profile attribute. The form is accessed via a deep link configured on the customer's profile. Upon making and submitting the desired edits, the associate will trigger a request to the UPDATE_CUSTOMER endpoint, and result in the specified changes to the customer's profile.

To summarize, the clienteling endpoints are invoked in the following POS flows:
| **Endpoint Name** | **Associate Journey on POS** | **Layout** |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SEARCH_CUSTOMERS | Associate performs a customer search to find an existing profile: - Whether customer already logged in and changing to another profile, or none logged in - Whether during checkout or clienteling activities | Customer Search |
| CREATE_CUSTOMER | Create customer profile using New Customer Sign-up | Customer Signup |
| GET_CUSTOMER | Selecting a customer’s profile from the customer search results | Retrieving a customer’s details does not require a layout, but it’s important to have a clienteling profile layout so associates can view key attributes, order history, and loyalty status of a customer. |
| UPDATE_CUSTOMER | Edit customer profile, for example, with Edit layout accessed from Customer 360 | Customer Signup |
**note:** When creating layouts for the above Clienteling operations, refer to [Clienteling SPI Field Mapping](https://developer.salesforce.com/docs/commerce/retail-cloud/guide/clienteling-spi-field-mapping.html) for a complete mapping between the template tags you configure on the layout and the corresponding attributes of the objects exchanged with the SPI endpoint.
### Key Resources and Clienteling Data Model
In general, the core resource being exchanged in Clienteling workflows is the customer object, which comprises addresses, consents, customer profiles, and loyalty profiles.
```json
{
addressList: [...],
consents: [...],
profile: [...],
customerLoyaltyProfile: [...],
storeAttribution: [...]
}
```
This object represents a shopper–their name and contact information, their addresses for billing and shipping, and many other attributes, including, whether they’ve consented to terms and conditions, marketing communications, and loyalty program enrollment.
For each parameter of the customer object, see the below for a summary overview:
| **Parameter** | **Type** | **Description** |
| ---------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| addressList | Array of dictionaries | Customer's list of Addresses used for billing and shipping. The Address object represents a customer address, typically for shipping, but also for billing, when applicable. It is passed as part of the Clienteling SPI endpoints’ addressList parameter, which is all shipping and billing addresses associated to a customer. It is also part of the Customer object, in profile.address and customerLoyaltyProfile.address. |
| consents | Dictionary of booleans | Customer consents. Child attributes: • consents.agreeToTC • consents.directMailSignUp • consents.eReceipt • consents.loyaltySignUp • consents.newsLetterSignUp • consents.phoneSignUp • consents.smsSignUp |
| profile | Dictionary | Customer profile object. Some of its child attributes are: • address • customerId • email • firstName • postalCode • customerGroup • loyaltyId • preferredLanguage • country • allowSmsNotifications It encapsulates a customer’s personal and contact information, their loyalty ID, and other attributes. For order-related SPIs and webhooks, the profile object is used to exchange customer information associated with a sale. |
| customerLoyaltyProfile | Dictionary | This object represents the customer loyalty profile, which is used if you are managing a customer loyalty program in Point of Sale. Some of its child attributes are: • accountNumber • address • cashRewards • currentPoints • currentStoreCredit • currentTier • customLoyaltyAttributes • firstName • lastName |
| storeAttribution | Dictionary | This captures the store ID and ID of the associate who creates the customer account and completes the transaction. |
## Example Scenarios: SPI Requests and Responses in Practice
### Scenario 1: Create Customer Profile
In this scenario, a store associate completes and submits the Customer Signup layout for the shopper, triggering a POST request to the merchant’s CREATE_CUSTOMER SPI endpoint. A response with the new customer object is provided to the POS.
**Request**
```json
{
"profile": {
"email": "timothy@gmail.com",
"firstName": "timothy",
"lastName": "smith",
"address": {
"addressLine1": "111 Wilshire Boulevard",
"addressLine2": "",
"city": "Santa Monica",
"state": "CA",
"postalCode": "90401",
"countryCode": "US",
"preferred": false
},
"phoneMobile": ""
},
"consents": {
"newsLetterSignUp": true,
"loyaltySignUp": true
},
"storeAttribution": {
"storeAssociateId": "as1",
"storeId": "1920"
}
}
```
**Response**
Note that the customer's identifying attributes (name, email, etc.) and address are added to the customer profile object under **customer.profile** and **customer.profile.address**, respectively. The customer's address is also added to **customer.loyaltyProfile.address** (because the customer consented to participating in the merchant's loyalty program) and to **customer.addressList**.
```json
{
"loyaltyProfile": {
"accountNumber": "12344",
"address": {
"addressId": "09999",
"addressLine1": "111 Wilshire Boulevard",
"city": "Santa Monica",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"state": "CA",
"storeId": "1920"
},
"currentTier": {
"display": "https://acme.com/loyalty/image/upload/star-silver.png",
"name": "SILVER"
},
"loyaltyId": "1",
"nextTier": {},
"rewards": [],
"tierLevelCode": "SILVER"
},
"profile": {
"address": {
"addressId": "09999",
"addressLine1": "111 Wilshire Boulevard",
"city": "Santa Monica",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"state": "CA",
"storeId": "1920",
"emailAddress": "timothy@gmail.com"
},
"customerId": "234900",
"email": "timothy@gmail.com",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"customerGroup": "SILVER"
},
"addressList": [
{
"addressId": "09999",
"addressLine1": "111 Wilshire Boulevard",
"city": "Santa Monica",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"state": "CA",
"storeId": "1920"
}
],
"consents": {
"agreeToTC": true,
"directMailSignUp": true,
"eReceipt": true,
"loyaltySignUp": true,
"newsLetterSignUp": true,
"phoneSignUp": true,
"smsSignUp": true
}
}
```
### Scenario 2: Add New Shipping Address to Profile From Cart
In this scenario, a store associate is placing an order for a customer. The associate searches and retrieves the customer’s profile, logging them in on the POS. Then, when selecting a shipping address for the order, the associate enters a new address for the customer instead of the existing address on file. The option to “Save this address to profile” is toggled on. After adding the new shipping address, a PUT request is sent to the merchant’s UPDATE_CUSTOMER SPI endpoint. As a result, the new address is added to the addressList array in the Customer object, **customer.addressList**.
**Request**
```json
{
"customerId": "234900",
"address": {
"addressName": "Timothy Smith",
"firstName": "Timothy",
"lastName": "Smith",
"addressLine1": "1100 Van Ness Avenue",
"addressLine2": "",
"addressLine3": "",
"addressLine4": "",
"city": "San Francisco",
"state": "CA",
"postalCode": "94109",
"countryCode": "US",
"isDefaultBilling": false,
"isDefaultShipping": false,
"preferred": false,
"emailAddress": "timothy@gmail.com"
}
}
```
**Response**
```json
{
"loyaltyProfile": {
"accountNumber": "12344",
"address": {
"addressId": "09999",
"addressLine1": "111 Wilshire Boulevard",
"city": "Santa Monica",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"state": "CA",
"storeId": "1920"
},
"currentTier": {
"display": "https://acme.com/loyalty/image/upload/star-silver.png",
"name": "SILVER"
},
"loyaltyId": "1",
"nextTier": {},
"rewards": [],
"tierLevelCode": "SILVER"
},
"profile": {
"address": {
"addressId": "09999",
"addressLine1": "111 Wilshire Boulevard",
"city": "Santa Monica",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"state": "CA",
"storeId": "1920",
"emailAddress": "timothy@gmail.com"
},
"customerId": "234900",
"email": "timothy@gmail.com",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "94109",
"customerGroup": "SILVER"
},
"addressList": [
{
"addressId": "10000",
"addressLine1": "1100 Van Ness Avenue",
"city": "San Francisco",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "94109",
"state": "CA",
"storeId": "1920"
},
{
"addressId": "09999",
"addressLine1": "111 Wilshire Boulevard",
"city": "Santa Monica",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"state": "CA",
"storeId": "1920"
}
],
"consents": {
"agreeToTC": true,
"directMailSignUp": true,
"eReceipt": true,
"loyaltySignUp": true,
"newsLetterSignUp": true,
"phoneSignUp": true,
"smsSignUp": true
}
}
```
### Scenario 3: Update Customer Profile
In this scenario, a store associate searches and retrieves an existing customer, logging them in on the POS. Then the associate uses a deep link on that customer’s clienteling profile to edit the profile information. The associate edits the customer’s profile address. When the edits on the customer layout are submitted, a PUT request is sent to the merchant’s UPDATE_CUSTOMER SPI endpoint.
Below you can see the request and response payloads for that operation. Notice that, in the response, there are three changes:
- **customer.loyaltyProfile.address** and **customer.profile.address** are updated to the new address
- and the new address is appended to the **customer.addressList** array
**Request**
```json
{
"profile": {
"email": "timothy@gmail.com",
"firstName": "Timothy",
"lastName": "Smith",
"address": {
"firstName": "Timothy",
"lastName": "Smith",
"addressLine1": "241 West 107th Street",
"addressLine2": "",
"city": "New York",
"state": "NY",
"postalCode": "10025",
"countryCode": "US",
"storeId": "1920",
"preferred": true
},
"phoneMobile": ""
},
"addressList": [],
"consents": {
"smsSignUp": true,
"newsLetterSignUp": true,
"agreeToTC": true,
"directMailSignUp": true,
"phoneSignUp": true,
"loyaltySignUp": true,
"eReceipt": true
},
"storeAttribution": {
"storeAssociateId": "as1",
"storeId": "1920"
}
}
```
**Response**
```json
{
"loyaltyProfile": {
"accountNumber": "12344",
"address": {
"addressId": "10003697201",
"addressLine1": "241 West 107th Street",
"city": "New York",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "10025",
"state": "NY",
"storeId": "1920"
},
"currentTier": {
"display": "https://acme.com/loyalty/image/upload/star-silver.png",
"name": "SILVER"
},
"loyaltyId": "1",
"nextTier": {},
"rewards": [],
"tierLevelCode": "SILVER"
},
"profile": {
"address": {
"addressId": "10001",
"addressLine1": "241 West 107th Street",
"city": "New York",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "10025",
"state": "NY",
"storeId": "1920",
"emailAddress": "timothy@gmail.com"
},
"customerId": "234900",
"email": "timothy@gmail.com",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"customerGroup": "SILVER"
},
"addressList": [
{
"addressId": "09999",
"addressLine1": "111 Wilshire Boulevard",
"city": "Santa Monica",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "90401",
"state": "CA",
"storeId": "1920"
},
{
"addressId": "10000",
"addressLine1": "1100 Van Ness Avenue",
"city": "San Francisco",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "94109",
"state": "CA",
"storeId": "1920"
},
{
"addressId": "10001",
"addressLine1": "241 West 107th Street",
"city": "New York",
"countryCode": "US",
"firstName": "Timothy",
"lastName": "Smith",
"postalCode": "10025",
"state": "NY",
"storeId": "1920"
}
],
"consents": {
"agreeToTC": true,
"directMailSignUp": true,
"eReceipt": true,
"loyaltySignUp": true,
"newsLetterSignUp": true,
"phoneSignUp": true,
"smsSignUp": true
}
}
```
# Clone On-Demand Sandboxes
Use on-demand sandbox cloning to create exact replicas of existing sandboxes in minutes, not hours. It helps teams move faster while reducing risk by providing fully isolated environments for development, testing, and operational workflows.
With a single API call, provision a fully isolated replica of your sandbox that includes your database, application code, platform configurations, and all configured feature toggles.
To maintain a consistent and reliable clone, the source sandbox is automatically placed in a protected Stopped state during the initial backup phase of the cloning process. This safeguard guarantees data integrity and configuration consistency. After the backup completes, the source sandbox becomes available again, while the remaining clone phases continue in the background.
Each cloned sandbox is fully isolated, with dedicated compute, storage, and database resources.
Typical use cases include:
- Reproducing production bugs safely without impacting live systems
- Validating disaster recovery plans in isolated replicas
- Spinning up development or test environments for teams quickly
- Validating upgrades and configuration changes before deployment
- Testing feature or performance changes before deployment
- Supporting CI/CD pipelines with on-demand test environments
- Providing realistic training or experimentation environments
- Optimizing costs by cloning sandboxes only when needed
## What Is Included in a Clone
A sandbox clone includes:
- Database schema and data
- Custom code and cartridges
- Storefront, site data, and configurations
- Catalogs and pricebooks
- Orders and content data
- Feature toggles
- Maintenance pages
- Standard platform configuration files
## What Is Not Included
The following data is excluded to protect security, privacy, and tenant integrity:
- Logs and jobs history
- Customer PII and GDPR-related data
- Analytics data
- Geolocation data
- Order activity
- Exchange rate data
- Change logs
- Tenant-specific configurations
Sensitive data is either omitted or transformed to ensure compliance with platform security and privacy requirements.
## How Sandbox Cloning Works
The cloning process includes six detailed steps grouped into four main progress stages:
1. **Prep Instance**
- Validation: Checks the source sandbox status, permissions, and resource availability.
2. **Data Backup**
- Backup Creation: Creates a consistent snapshot of the source database, sharedata and configurations.
3. **Data Restore**
- Target Provisioning: Allocates compute, storage, and network resources for the new sandbox.
- Data Restoration: Copies database tables, indexes, and files to the cloned environment.
- Configuration Transformation: Updates system files and credentials to ensure independence.
4. **Post Validation**
- Activation: Validates sandbox health, tests connectivity, and makes the clone available.
Total duration is typically 10–30 minutes, depending on sandbox size and data volume.
The source sandbox is unavailable only during the initial backup phase of the clone operation. Once the backup is complete, the source sandbox becomes available again. If the source sandbox was running when the clone operation was initiated, it's automatically restarted after the backup completes. If it was already stopped, it remains in the stopped state.
The remaining phases of the clone operation continue in the background and don't require the source sandbox to be stopped.
Although the source sandbox becomes available before the clone operation finishes, you can't start another clone from the same source until the current clone completes. See the [Sandbox Cloning FAQ](#sandbox-cloning-faq) for more details.
A clone request can target either a single sandbox (one-to-one cloning) or multiple sandboxes (one-to-many cloning), with up to five target sandboxes per request. With one-to-many cloning, the source sandbox is backed up once, and that backup is used to restore all target sandboxes in parallel. The source availability behavior remains the same regardless of the number of targets.
Each target sandbox progresses through cloning independently. If one target encounters an error, the remaining targets continue processing and can complete successfully.
## Prerequisites
To clone sandboxes, you need:
**Account Requirements**
- Sandbox API User role assigned in B2C Commerce Account Manager with realm/tenant-level access.
**Source Sandbox Requirements**
- Source sandbox must be in Running or Stopped state
- Source sandbox should be in Enabled state
- Source sandbox must not have pending operations
- Permissions to access source sandbox data
**note:** Sandbox cloning is also available through Control Center. For more information, see [Clone On-Demand Sandboxes for B2C Commerce](https://help.salesforce.com/s/articleView?id=cc.b2c_cc_clone_ods_instance.htm&type=5).
## Clone a Sandbox Using the API
Sandbox cloning is available through the B2C Commerce On-Demand Sandbox REST API. Use the clone API to programmatically create and manage sandbox clones, giving developers and admins full control over provisioning and monitoring of the clones.
Access documentation for the Clone APIs and issue API calls from the Sandbox API user interface at [https://admin.dx.commercecloud.salesforce.com/](https://admin.dx.commercecloud.salesforce.com/). Click **Authorize** to log in with the API Client ID you configured using Account Manager.
### Create a Clone
Initiate a clone operation using the POST endpoint.
**Request**
```http
POST /sandboxes/{sandboxId}/clones HTTP/1.1
Host: admin.dx.commercecloud.salesforce.com
Authorization: Bearer {access_token}
Content-Type: application/json
{
"targetProfile": "xlarge",
"emails": ["email1@example.com"],
"ttl": 24
}
```
**cURL**
```
curl -X 'POST' \
'https:///api/v1/sandboxes/{sandboxId}/clones' \
-H 'accept: application/json' \
-H 'authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"targetProfile": "medium",
"emails": [
"email1@example.com"
],
"ttl": 24
}'
```
**Parameters**
| Parameter | Type | Required | Description |
| ------------- | ------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sandboxId | string (UUID) | Yes | Unique identifier of the source sandbox to clone |
| targetProfile | string | Yes | Resource profile for the cloned sandbox: medium, large, xlarge, or xxlarge. Note: Target Profile can't be lower than the source sandbox. |
| targetCount | int | No | Number of sandbox clones to create from this source. Valid values: 1–5. Default: 1 (a single one-to-one clone). When greater than 1, the clones are created as a batch that shares a batchId. |
| emails | List | No | Email addresses for notifications |
| ttl | int | No | Number of hours for the sandbox clone lifetime. Default: 24 hours |
**Success Response (201 Created)**
```
{
"cloneId": "abcd-001-180620251331"
}
```
The cloneId can be used to track the clone operation status.
**Error Responses**
**400 Bad Request** - Illegal Argument
```
{
"kind": "Status",
"code": 400,
"status": "Failure",
"error": {
"status": "Failure",
"message": "Profile downgrade not allowed. Current profile: large, Requested profile: medium. Only same profile or upgrades are permitted.",
"reason": "IllegalArgument"
}
}
```
**403 Forbidden** - AccessDenied
```
{
"kind": "Status",
"code": 403,
"status": "Failure",
"error": {
"status": "Failure",
"message": "User doesn't have access to this realm",
"reason": "AccessDenied"
}
}
```
**404 Not Found** - Sandbox not found
```
{
"kind": "Status",
"code": 404,
"status": "Failure",
"error": {
"status": "Failure",
"message": "Sandbox '34801747-1011-43d0-a3b5-5d46f1b49dfb' doesn't exist.",
"reason": "SandboxNotFound"
}
}
```
### Create Multiple Clones (One-to-Many)
Set `targetCount` to a value from 2–5 to create multiple sandbox clones from the same source in a single request. The source sandbox is backed up once, and the backup is used to create each target sandbox in parallel. This approach reduces source downtime compared to submitting separate one-to-one clone requests.
To create multiple clones, add `targetCount` to the request body.
**Request**
```http
POST /sandboxes/{sandboxId}/clones HTTP/1.1
Host: admin.dx.commercecloud.salesforce.com
Authorization: Bearer {access_token}
Content-Type: application/json
{
"targetProfile": "xlarge",
"targetCount": 3,
"emails": ["email1@example.com"],
"ttl": 24
}
```
**cURL**
```
curl -X 'POST' \
'https:///api/v1/sandboxes/{sandboxId}/clones' \
-H 'accept: application/json' \
-H 'authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"targetProfile": "medium",
"targetCount": 3,
"emails": [
"email1@example.com"
],
"ttl": 24
}'
```
**Success Response (201 Created)**
```
{
"cloneId": "abcd-001-1784379488544",
"batchId": "batch-abcd-001-1784379488543-dfa36a1d",
"siblingCloneIds": [
"abcd-001-1784379488544",
"abcd-001-1784379488545",
"abcd-001-1784379488546"
]
}
```
Use the individual clone IDs in `siblingCloneIds` to monitor each target clone. See [Monitor Sandbox Clone Operations](#monitor-sandbox-clone-operations).
**Error Responses**
**400 Bad Request** - Illegal Argument
```
{
"kind": "Status",
"code": 400,
"status": "Failure",
"error": {
"status": "Failure",
"message": "targetCount must be between 1 and 5. Requested: {n}",
"reason": "IllegalArgument"
}
}
```
### Monitor Sandbox Clone Operations
Monitor the progress of a clone operation using the clone ID and source sandbox ID. This can also be used to retrieve details for a specific cloned sandbox.
**Request**
```
GET /sandboxes/{sandboxId}/clones/{cloneId}
Host: admin.dx.commercecloud.salesforce.com
Authorization: Bearer {access_token}
Content-Type: application/json
```
**cURL**
```
curl -X 'GET' \
'https:///api/v1/sandboxes//clones/' \
-H 'accept: application/json' \
-H 'authorization: Bearer ' \
-H 'Content-Type: application/json'
```
**Parameters**
| Parameter | Type | Required | Description |
| --------- | ------------- | -------- | ---------------------------------------- |
| sandboxId | string (UUID) | Yes | Unique identifier of the source sandbox |
| cloneId | string | Yes | Unique identifier of the clone operation |
**Success Response (200 OK)**
For a single (one-to-one) clone:
```
{
"cloneId": "abcd-001-1771055271197",
"realm": "abcd",
"sourceInstance": "001",
"targetInstance": "002",
"sourceInstanceId": "0c7bd46d-3300-4880-984f-cf8df01685e6",
"targetInstanceId": "2b2d1805-a66f-4b07-943f-9ef6808f5efa",
"targetProfile": "medium",
"createdAt": "2026-02-14T07:45:07.742Z",
"createdBy": "test@example.com",
"lastUpdated": "2026-02-14T07:45:07.742Z",
"status": "IN_PROGRESS",
"elapsedTimeInSec": 240,
"progressPercentage": 23,
"lastKnownState": "Data Backup In Progress",
"customCodeVersion": "SFRA_01_01_2026",
"storefrontCount": 1,
"filesystemUsageSize": 1024,
"databaseTransferSize": 2048
}
```
For a target that's part of a one-to-many batch, the response also includes `batchId` and `siblingCloneIds`:
```
{
"cloneId": "abcd-001-1784379488544",
"realm": "abcd",
"sourceInstance": "001",
"targetInstance": "002",
"sourceInstanceId": "0c7bd46d-3300-4880-984f-cf8df01685e6",
"targetInstanceId": "2b2d1805-a66f-4b07-943f-9ef6808f5efa",
"targetProfile": "medium",
"createdAt": "2026-02-14T07:45:07.742Z",
"createdBy": "test@example.com",
"lastUpdated": "2026-02-14T07:45:07.742Z",
"status": "IN_PROGRESS",
"elapsedTimeInSec": 240,
"progressPercentage": 23,
"lastKnownState": "Data Backup In Progress",
"customCodeVersion": "SFRA_01_01_2026",
"storefrontCount": 1,
"filesystemUsageSize": 1024,
"databaseTransferSize": 2048,
"batchId": "batch-abcd-001-1784379488543-dfa36a1d",
"siblingCloneIds": ["abcd-001-1784379488544", "abcd-001-1784379488545", "abcd-001-1784379488546"]
}
```
Each target has its own cloneId and its own independent status, so poll each cloneId from `siblingCloneIds` separately. One target completing, failing, or still running has no effect on the reported status of the others. Each response represents a single target in the batch, not the entire batch. All targets in the batch share the same `batchId`, and `siblingCloneIds` is identical in every target's response, listing all clones in the batch.
**Response Fields**
| Field | Type | Description |
| -------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
| cloneId | string | Unique identifier for the clone operation |
| realm | string | Four-letter realm identifier |
| sourceInstance | string | Source instance number |
| targetInstance | string | Target instance number |
| sourceInstanceId | string (UUID) | UUID of the source sandbox |
| targetInstanceId | string (UUID) | UUID of the cloned sandbox |
| targetProfile | string | Resource profile: medium, large, xlarge, or xxlarge |
| createdAt | string (ISO 8601) | Timestamp when clone was initiated |
| createdBy | string (email) | Email of user who initiated the clone |
| lastUpdated | string (ISO 8601) | Timestamp of most recent status update |
| status | string | Current status: IN_PROGRESS, COMPLETED, or FAILED |
| elapsedTimeInSec | integer | Elapsed time since clone started (seconds) |
| progressPercentage | integer | Completion progress (0-100) |
| lastKnownState | string | Current state of the clone progress |
| storefrontCount | integer | Count of storefronts |
| filesystemUsageSize | integer | Share data transfer size in megabytes |
| databaseTransferSize | integer | Database transfer size in megabytes |
| customCodeVersion | string | Code version |
| batchId | string | Shared batch identifier for clones created together via one-to-many cloning. Absent for a single (one-to-one) clone. |
| siblingCloneIds | array of string | cloneIds of all clones in the same batch, in target order (includes this clone). Absent for a single (one-to-one) clone. |
**Clone Status Values**
| Status | Description |
| ----------- | ------------------------------------------------------------------------- |
| IN_PROGRESS | Clone operation is currently running. Continue polling for updates. |
| COMPLETED | The clone operation finished successfully. Target sandbox is operational. |
| FAILED | Clone operation encountered an error. Review error details. |
**Error Responses**
**403 Forbidden** - AccessDenied
```
{
"kind": "Status",
"code": 403,
"status": "Failure",
"error": {
"status": "Failure",
"message": "User doesn't have access to this realm",
"reason": "AccessDenied"
}
}
```
**404 Not Found** - Invalid Sandbox Id
```
{
"kind": "Status",
"code": 404,
"status": "Failure",
"error": {
"status": "Failure",
"message": "DB entry for id '0c7bd46d-3300-4880-984f-cf8df01685e6' doesn't exist",
"reason": "NotFound"
}
}
```
**404 Not Found** - No Clone Found
```
{
"kind": "Status",
"code": 404,
"status": "Failure",
"error": {
"status": "Failure",
"message": "No clone found with id 'zyom-002-017-180620251331'",
"reason": "NotFound"
}
}
```
### List All Clones
Fetch details of all clone operations associated with a specific sandbox.
**Request**
```
GET /sandboxes/{sandboxId}/clones
Host: admin.dx.commercecloud.salesforce.com
Authorization: Bearer {access_token}
Content-Type: application/json
```
**cURL**
```
curl -X 'GET' \
'https:///api/v1/sandboxes//clones' \
-H 'accept: application/json' \
-H 'authorization: Bearer ' \
-H 'Content-Type: application/json'
```
**Parameters**
| Parameter | Type | Required | Description |
| --------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| sandboxId | string (UUID) | Yes | Unique identifier of the source sandbox to clone |
| fromDate | string (query) | No | Filter clones created on or after this date (ISO 8601 date format). When provided without toDate, toDate defaults to the current timestamp. |
| toDate | string (query) | No | Filter clones created on or before this date (ISO 8601 date format). If omitted when fromDate is provided, it defaults to the current timestamp. |
| status | string (query) | No | Filter clones by status. If not provided, returns all clones regardless of status. Available values: Pending, InProgress, Failed, Completed. |
| batchId | string (query) | No | Filter clones by their one-to-many batch identifier. When provided, returns only the clones that belong to that batch. |
**Success Response (200 OK)**
For a single (one-to-one) clone:
```
{
"clones": [
{
"cloneId": "abcd-001-1771055271197",
"realm": "abcd",
"sourceInstance": "001",
"targetInstance": "002",
"sourceInstanceId": "0c7bd46d-3300-4880-984f-cf8df01685e6",
"targetInstanceId": "2b2d1805-a66f-4b07-943f-9ef6808f5efa",
"targetProfile": "medium",
"createdAt": "2026-02-14T07:45:07.742Z",
"createdBy": "test@example.com",
"lastUpdated": "2026-02-14T07:45:07.742Z",
"status": "IN_PROGRESS",
"elapsedTimeInSec": 240,
"progressPercentage": 23,
"lastKnownState": "Data Backup In Progress",
"customCodeVersion": "SFRA_01_01_2026",
"storefrontCount": 1,
"filesystemUsageSize": 1024,
"databaseTransferSize": 2048
}
]
}
```
Filtered by `batchId`, showing every target in the batch as its own row:
```
{
"clones": [
{
"cloneId": "abcd-001-1784379488544",
"realm": "abcd",
"sourceInstance": "001",
"targetInstance": "002",
"sourceInstanceId": "0c7bd46d-3300-4880-984f-cf8df01685e6",
"targetInstanceId": "2b2d1805-a66f-4b07-943f-9ef6808f5efa",
"targetProfile": "medium",
"createdAt": "2026-02-14T07:45:07.742Z",
"createdBy": "test@example.com",
"lastUpdated": "2026-02-14T08:00:19.742Z",
"status": "COMPLETED",
"elapsedTimeInSec": 912,
"progressPercentage": 100,
"lastKnownState": "Completed",
"customCodeVersion": "SFRA_01_01_2026",
"storefrontCount": 1,
"filesystemUsageSize": 1024,
"databaseTransferSize": 2048,
"batchId": "batch-abcd-001-1784379488543-dfa36a1d",
"siblingCloneIds": ["abcd-001-1784379488544", "abcd-001-1784379488545", "abcd-001-1784379488546"]
},
{
"cloneId": "abcd-001-1784379488545",
"realm": "abcd",
"sourceInstance": "001",
"targetInstance": "003",
"sourceInstanceId": "0c7bd46d-3300-4880-984f-cf8df01685e6",
"targetInstanceId": "faa21fa1-38b2-4f84-b892-f9967522e89e",
"targetProfile": "medium",
"createdAt": "2026-02-14T07:45:07.742Z",
"createdBy": "test@example.com",
"lastUpdated": "2026-02-14T07:53:07.742Z",
"status": "IN_PROGRESS",
"elapsedTimeInSec": 480,
"progressPercentage": 47,
"lastKnownState": "Data Restore In Progress",
"customCodeVersion": "SFRA_01_01_2026",
"storefrontCount": 1,
"filesystemUsageSize": 1024,
"databaseTransferSize": 2048,
"batchId": "batch-abcd-001-1784379488543-dfa36a1d",
"siblingCloneIds": ["abcd-001-1784379488544", "abcd-001-1784379488545", "abcd-001-1784379488546"]
},
{
"cloneId": "abcd-001-1784379488546",
"realm": "abcd",
"sourceInstance": "001",
"targetInstance": "004",
"sourceInstanceId": "0c7bd46d-3300-4880-984f-cf8df01685e6",
"targetInstanceId": "9d4e7c02-1a5b-4f83-b6e2-7c3a8d1f6b40",
"targetProfile": "medium",
"createdAt": "2026-02-14T07:45:07.742Z",
"createdBy": "test@example.com",
"lastUpdated": "2026-02-14T07:50:12.742Z",
"status": "FAILED",
"elapsedTimeInSec": 305,
"progressPercentage": 31,
"lastKnownState": "Failed",
"customCodeVersion": "SFRA_01_01_2026",
"storefrontCount": 1,
"filesystemUsageSize": 1024,
"databaseTransferSize": 2048,
"batchId": "batch-abcd-001-1784379488543-dfa36a1d",
"siblingCloneIds": ["abcd-001-1784379488544", "abcd-001-1784379488545", "abcd-001-1784379488546"]
}
]
}
```
**Response Fields**
| Field | Type | Description |
| -------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
| cloneId | string | Unique identifier for the clone operation |
| realm | string | Four-letter realm identifier |
| sourceInstance | string | Source instance number |
| targetInstance | string | Target instance number |
| sourceInstanceId | string (UUID) | UUID of the source sandbox |
| targetInstanceId | string (UUID) | UUID of the cloned sandbox |
| targetProfile | string | Resource profile: medium, large, xlarge, or xxlarge |
| createdAt | string (ISO 8601) | Timestamp when clone was initiated |
| createdBy | string (email) | Email of user who initiated the clone |
| lastUpdated | string (ISO 8601) | Timestamp of most recent status update |
| status | string | Current status: IN_PROGRESS, COMPLETED, or FAILED |
| elapsedTimeInSec | integer | Elapsed time since clone started (seconds) |
| progressPercentage | integer | Completion progress (0-100) |
| lastKnownState | string | Current state of the clone progress |
| storefrontCount | integer | Count of storefronts |
| filesystemUsageSize | integer | Share data transfer size in megabytes |
| databaseTransferSize | integer | Database transfer size in megabytes |
| customCodeVersion | string | Code version |
| batchId | string | Shared batch identifier for clones created together via one-to-many cloning. Absent for a single (one-to-one) clone. |
| siblingCloneIds | array of string | cloneIds of all clones in the same batch, in target order (includes this clone). Absent for a single (one-to-one) clone. |
**Clone Status Values**
| Status | Description |
| ----------- | ------------------------------------------------------------------------- |
| IN_PROGRESS | Clone operation is currently running. Continue polling for updates. |
| COMPLETED | The clone operation finished successfully. Target sandbox is operational. |
| FAILED | Clone operation encountered an error. Review error details. |
**Error Responses**
**403 Forbidden** - AccessDenied
```
{
"kind": "Status",
"code": 403,
"status": "Failure",
"error": {
"status": "Failure",
"message": "User doesn't have access to this realm",
"reason": "AccessDenied"
}
}
```
**404 Not Found** - Invalid Sandbox Id
```
{
"kind": "Status",
"code": 404,
"status": "Failure",
"error": {
"status": "Failure",
"message": "DB entry for id '0c7bd46d-3300-4880-984f-cf8df01685e6' doesn't exist",
"reason": "NotFound"
}
}
```
## Additional Configuration Required
After cloning completes, you must manually update (if any):
- Custom tenant-specific configurations
- Hard-coded URLs in custom cartridges or scripts
- Third-party service URLs and API endpoints
- Keystore references and certificates tied to the source sandbox
- Custom jobs or schedules that reference the source instance
**note:** In a one-to-many clone, these steps apply per target. Repeat them for each resulting sandbox.
## Best Practices
**Choose Appropriate Resource Profiles**
Select the profile that meets your requirements. For cloning, the target profile should be the same size or larger than the source sandbox profile.
**Review Custom Configurations**
After cloning completes, test all integrations and custom configurations. Update third-party endpoints, keystores, and Business Manager customizations that reference the source sandbox.
**Manage Cloned Sandboxes**
Delete cloned sandboxes when no longer needed to reduce credit consumption.
**Plan Clone Operations**
Where feasible, execute large clone operations during times when sandbox usage is low.
**Save Your Work**
During the initial backup phase of the clone process, the source sandbox is stopped. Make sure to save any open work before triggering the clone operation.
**Monitor Clone Progress**
Monitor the progress of a clone using the Monitor Clone Progress API. Poll the API every 30–60 seconds to check status, but avoid excessive polling, which may trigger rate limits. For a one-to-many clone, poll each target's cloneId independently. Don't assume all targets finish at the same time or that one target's failure affects the others.
**Set Time-to-Live Values**
Configure the ttl parameter to automatically clean up temporary clones and avoid consuming unnecessary credits.
**Resume Work on the Source Early**
The source sandbox becomes available again shortly after the clone starts, once the backup stage completes. You don't need to wait for the full clone to finish before resuming work on the source. You still can't trigger a new clone on that same source until the current one completes, even though the source itself is available again.
**Plan Multi-Target Requests**
When cloning to multiple targets, the source is stopped once, for the duration of the single shared backup step, not once per target. The targetProfile, emails, and ttl values apply to the entire batch. If different targets need different settings, submit separate clone requests, or clone with shared settings and adjust individual targets afterward using the Sandbox Update API (PATCH /sandboxes/{sandboxId}).
## Sandbox Cloning FAQ
**Q.** What state must the source sandbox be in to perform a clone?\
**A.** The source sandbox must be in an Enabled state, either Running or Stopped, to be successfully cloned.
**Q.** What happens to the source sandbox during cloning?\
**A.** It's placed in a Stopped state during the initial backup phase to protect data integrity. After the backup completes, the source becomes available again, although you can't start another clone from it until the current clone finishes.
**Q.** Can multiple clone operations run from the same source sandbox at the same time?\
**A.** No. Only one clone can run per source sandbox at a time, however different source sandboxes can be cloned simultaneously.
**Q.** Where is the cloned sandbox created?\
**A.** It's created in the same realm as the source sandbox.
**Q.** Are platform configuration files updated automatically during cloning?\
**A.** Standard platform configurations are updated automatically. Custom configurations must be reviewed manually.
**Q.** Are tenant-specific configurations and customizations updated automatically?\
**A.** No. Tenant-specific configurations, custom keystores, certificates, and Business Manager customizations aren't updated automatically.
**Q.** Can a clone operation be paused or resumed?\
**A.** No. Once started, a clone operation can't be paused or resumed.
**Q.** How long does cloning usually take?\
**A.** It typically takes 10–30 minutes. In rare cases, it may take up to 60 minutes. If it exceeds 60 minutes, the process fails and the source sandbox is restored.
**Q.** Are there any credit requirements for cloning?\
**A.** Yes. A sufficient credit balance is required for both the clone operation and the target sandbox uptime.
**Q.** What happens to feature toggles during cloning?\
**A.** Any manually set or customized feature toggles are copied to the cloned sandbox.
**Q.** What is the default minimum TTL (Time To Live) for a cloned sandbox?\
**A.** The minimum TTL is 24 hours to avoid accidental deletion during setup.
**Q.** Can I clone a sandbox to a profile lower than the current profile of the source sandbox?\
**A.** No. The cloned sandbox can have a profile that is the same as or higher than the source sandbox's profile, but not lower.
**Q.** What happens if I accidentally delete the source sandbox after successfully creating the clone?\
**A.** Once the clone sandbox is successfully created, it operates as an independent sandbox. Deleting the source sandbox will have no impact on the cloned sandbox.
**Q.** What happens if I don't include the emails attribute when calling the Create Clone API?\
**A.** If you don't explicitly provide the emails attribute, the cloned sandbox won't inherit or copy the email settings from the source sandbox by default.
**Q.** Can I clone a sandbox to more than one target at once?\
**A.** Yes. Set targetCount to a value from 1–5 in your clone request. The source is backed up once and restored to all targets concurrently.
**Q.** Is there a limit on how many targets I can clone to at once?\
**A.** Yes. targetCount accepts values from 1–5.
**Q.** If one target fails in a one-to-many clone, do the others fail too?\
**A.** No. Each target is tracked and processed independently. A failure on one target has no effect on the others. Check each target's cloneId status individually.
**Q.** Can I set a different profile, TTL, or notification email list for each target in a one-to-many clone?\
**A.** No. targetProfile, ttl, and emails apply to the whole request, not per target. Submit separate clone requests if targets need different settings, or use the Sandbox Update API to adjust individual targets afterward.
**Q.** If my source sandbox becomes available again early, can I start another clone on it right away?\
**A.** No. Although the source sandbox becomes available shortly after the backup stage completes, you can't trigger a new clone on that same source until the current clone operation finishes (Completed or Failed). The early availability lets you resume other work on the source sooner. It doesn't open a new clone slot.
# Clone On-Demand Sandboxes for B2C Commerce
Create replicas of existing on-demand sandboxes for development, testing, and operational workflows.
**note:** For detailed information about the cloning process, including what data is included or excluded, configuration requirements, and how the cloning workflow operates, see [Clone On-Demand Sandboxes](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-clone-on-demand-sandboxes.html) in the API documentation.
CMS User Management API
# CMS User Management API
[Download specification](https://developer.salesforce.com/static/commercecloud/retail-cloud/cms-user-management-api/cms-user-management-api-oas-public.yaml)
Merchant API to create, search, update, and delete CMS users from the POS system.
**Version:** 2.3.4
## Tags
### CMS User Management API
[Download specification](https://developer.salesforce.com/static/commercecloud/retail-cloud/cms-user-management-api/cms-user-management-api-oas-public.yaml)
Merchant API to create, search, update, and delete CMS users from the POS system.
## Operations
### GET Get CMS users.
`GET /merchant/{version}/users`
Operation ID: `getUsers`. Tags: CMS User Management API.
Retrieve all CMS users.
#### Parameters
* `PredictSpring-Secret` (header, string)
* `version` (path, string, required) Supported: v1.
Pattern: v1|v2.
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `ListUserAccountsResponse`.
### PUT Update a CMS user.
`PUT /merchant/{version}/users`
Operation ID: `updateUser`. Tags: CMS User Management API.
Update a CMS user. If the user is updated successfully, the successful response includes a list of all users. Otherwise, the response includes ErrorMessage and ErrorCode corresponding to the failure.
#### Parameters
* `PredictSpring-Secret` (header, string)
* `version` (path, string, required) Supported: v1.
Pattern: v1|v2.
#### Request body
Media type: `application/json`. Schema: `EditUserRequest`.
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `ListUserAccountsResponse`.
### POST Create CMS users.
`POST /merchant/{version}/users`
Operation ID: `createUsers`. Tags: CMS User Management API.
Create CMS users. If the users are created successfully, the response includes all users. Otherwise, the response includes ErrorMessage and ErrorCode corresponding to the failure.
#### Parameters
* `PredictSpring-Secret` (header, string)
* `version` (path, string, required) Supported: v1.
Pattern: v1|v2.
#### Request body
Media type: `application/json`. Schema: `CreateCMSUsersRequest`.
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `ListUserAccountsResponse`.
### DELETE Delete a CMS user.
`DELETE /merchant/{version}/users`
Operation ID: `deleteUser`. Tags: CMS User Management API.
Delete the provided CMS user. On successful deletion, the response includes a list of all remaining users. Otherwise, it contains ErrorMessage and ErrorCode corresponding to the failure.
#### Parameters
* `PredictSpring-Secret` (header, string)
* `version` (path, string, required) Supported: v1.
Pattern: v1|v2.
* `userId` (query, string)
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `ListUserAccountsResponse`.
### PATCH Update CMS users.
`PATCH /merchant/{version}/users`
Operation ID: `patchUsers`. Tags: CMS User Management API.
Update the CMS users in the request. If all users are updated successfully, the successful response includes a list of all users. Otherwise, the response includes ErrorMessage and ErrorCode corresponding to the failure.
**Limit:** 100 users per request.
Validation includes:
1. Empty or null request
2. Valid existing CMS users.
#### Parameters
* `PredictSpring-Secret` (header, string)
* `version` (path, string, required) Supported: v1.
Pattern: v1|v2.
#### Request body
Media type: `application/json`. Schema: `UpdatesCMSUsersRequest`.
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `ListUserAccountsResponse`.
### GET Get CMS user.
`GET /merchant/{version}/users/{userId}`
Operation ID: `getUserByUserId`. Tags: CMS User Management API.
Retrieve CMS user details.
#### Parameters
* `PredictSpring-Secret` (header, string)
* `version` (path, string, required) Supported: v1.
Pattern: v1|v2.
* `userId` (path, string, required)
#### Responses
* **default** Default response.
Media type: `application/json`. Schema: `UserAccount`.
## Schemas
### ListUserAccountsResponse
Payload that contains the list of CMS users.
* `errorMessage` (_string_, nullable) Error message shown to the user.
Example: `Invalid request. Please check the request and try again.`.
* `errorCode` (_string_, nullable) Error code shown to the user.
Example: `INTERNAL_ERROR`.
* `users` (_array of UserAccount_) List of CMS users.
* `error` (_boolean_)
### EditUserRequest
* `oldUserId` (_string_, required) The existing user ID.
* `newUserId` (_string_, nullable) New user ID. Must be a valid Google account.
* `role` (_string_, nullable) New Role.
* `timeZoneId` (_string_, nullable) New timezone ID. Don't use a timezone abbreviation.
Example: `America/Los_Angeles`.
* `userType` (_string_, nullable) New user type.
Allowed values: `GLOBAL`, `REGIONAL`. Example: `GLOBAL`.
### CreateCMSUsersRequest
Request payload to create the CMS users.
* `userAccounts` (_array of UserAccount_) List of users for CMS account creation.
### UpdatesCMSUsersRequest
* `userRequestList` (_array of EditUserRequest_)
### UserAccount
Payload that contains information about CMS user.
* `userId` (_string_, required) User ID. Must be a valid Google account.
* `merchantId` (_string_, required) Merchant ID.
* `permissions` (_string_, nullable) User's permission in CMS in the JSON form.
Example: `{"role":"CMS POWER USER","permissions":[{"LAYOUTS":["EDIT"]},{"FEEDS":["EDIT"]}]}`.
* `role` (_string_, nullable) User's role.
Default: `CMS POWER USER`.
* `timeZoneId` (_string_, nullable) User's timezone ID. Don't use a timezone abbreviation.
Default: `UTC`. Example: `America/Los_Angeles`.
* `userType` (_string_) User Type.
Allowed values: `GLOBAL`, `REGIONAL`. Default: `GLOBAL`.
# Code Deployment
Manage code versions and securely upload code.
## Code Versions
B2C Commerce supports multiple custom code versions uploaded to the system at the same time. The code is arranged in a top-level directory, called `Version Directories.` Name each directory in accordance with your versions, for example, `v12` or `summer_release`.
### Code Versions and the Active Version
When developing your storefront, select one _active_ code version with which to work by clicking App Launcher  and then selecting **Administration** > **Site Development** > **Code Deployment**. Select a version directory as the active version for a site. All templates, pipelines, scripts, and images are taken from this _active_ version.
B2C Commerce automatically and asynchronously removes the oldest code versions on all instance types. The active code version and the previously active code version aren't included in this process. Configure the number of retained code versions.
Roll back your storefront to a previous version if necessary. Develop your application with a newer version while maintaining an active storefront on a stable code base.
B2C Commerce doesn't let you upload code using a .zip file containing a distinct code version. Instead, you must upload your cartridge. Most development teams have a regular method for uploading code to staging.
#### Troubleshooting Tip for Code Versioning
If you get the following error when you try to view the storefront, check that you're uploading your cartridge to the current code version.
```
Technical Page There were technical problems while the request was being processed!
Executed Request:
Default Technical Details: System template default used directly or indirectly in custom site
```
**note:** Plan to test a new code version first on a Staging instance before moving it to the Production instance.
### Code Uploads to an Active or Inactive Version
Best practice is to upload code into an inactive version on a Staging instance and later replicate the code to a Development or Production instance.
Code uploads into an _active_ version are only allowed on Staging, Development, and Sandbox instances. Production instances reject WebDAV-based code uploads that occur directly into the currently active version. Code uploads onto a Production instance can only be to an inactive version.
### Code Compatibility Mode
Specify the active compatibility mode (API version). B2C Commerce supports activating a new compatibility mode or reverting to the previously active compatibility mode.
Replicate code to another system. Code Replication transports the active code version from the staging instance to the target production or development instance.
**note:** The term `Compatibility Mode` is interchangeable with the term `API Version.`
## Manage Code Versions
A code version is a folder that contains custom cartridges. An instance uses the currently active code version. Upload additional code versions to the server via WebDAV. These can be new code versions that will be activated later, or previous ones to allow for code rollbacks.
A compatibility mode can be assigned to each code version and is activated when the code version is activated. Code versions that haven't been explicitly assigned to a compatibility mode are marked with an asterisk (\*) and assume the current active compatibility mode. Selectable compatibility modes are those that are newer than the active compatibility mode, in addition to the previously active compatibility mode. You can't select a compatibility mode that is older than the previously active one.
The platform automatically and asynchronously removes the oldest code versions on all instance types. The active code version and the previously active code version aren't included in this process. Configure the number of retained code versions (see below).
The platform automatically and asynchronously removes the oldest code versions on all instance types. The active code version and the previously active code version aren't included in this process. You can configure the number of retained code versions (see below).
### Manage Code Versions with the B2C Commerce CLI
Instead of manual uploads via Business Manager, you can use the CLI to push and activate code versions in a single step. This is the recommended method for GitHub Actions or Jenkins pipelines. First, see [Agentic B2C Developer Toolkit](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/b2c-developer-tooling.md) to install the tool and authenticate.
Once configured, use the CLI to push and activate a code version:
```bash
# Deploy cartridges and activate the code version
b2c code deploy --code-version --reload
# Or activate separately
b2c code activate
```
For local development, use `b2c code watch` to continuously sync cartridge file changes to your sandbox so edits are reflected immediately without a full redeploy:
```bash
b2c code watch --code-version
```
For a complete list of code deployment CLI commands, see [Code Commands](https://salesforcecommercecloud.github.io/b2c-developer-tooling/cli/code.html).
### Manage Code Versions with Business Manager
1. Click App Launcher  and then select **Administration** > **Sites** > **Manage Sites**. You must assign custom cartridges to sites.
2. Click App Launcher  and then select **Administration** > **Site Development** > **Code Deployment**.
On the Manage Code Versions page, there are two timestamp columns:
- Modification time: Ddate and time the code was created or last updated on the instance.
- Activation time: Date and time of the last code activation.
The timestamp changes after an activation, roll back (for the new active version), or replication. Code versions that weren't activated don't show an activation time, for example, a new code version.
If you upload code changes without creating a new cartridge, activation time represents the date and time the code initially went live on a Production instance.
3. Click a link in the Code Version column.
The Version Summary page opens, where you can drill down into the code via WebDAV.
4. Click a compatibility mode link to view a list of available compatibility modes.
The Compatibility Mode page opens with a list of available compatibility modes.
- The currently active compatibility mode
- The previously active compatibility mode
- Any new compatibility modes that you can select
Each compatibility mode provides a Change Docs link that provides a summary of applicable changes and a Documentation link to the respective API documentation.
5. Click **Back** to return to the Manage Code Versions page.
6. To rename a code version, click **Rename** beside a code version in the list.
Renaming a code version also changes the respective entries in the version file.
7. To activate a code version, click **Activate** beside a code version in the list.
It isn't possible to select a compatibility mode older than the previously active one.
A code version is activated by adding its folder to the list of folders in which the server looks up resources. At the same time, the folder of the previous active code version is removed from the list.
The features included in the new code version are immediately available. Cached items (which might be dependent on a change to the compatibility mode) are cleared after activating a new code version.
8. Click **Rollback** to automatically activate the previous code version, if this code version is still installed.
If the previous code version is no longer available (it has been deleted), the rollback fails. The action also activates the compatibility mode associated with the previous code version.
9. Select one or more inactive code versions and click **Delete** to delete them. You can't delete the active code version.
10. Click **Add** to create a new empty code version. The new code version will be set to the currently active compatibility mode.
To protect B2C Commerce against directory traversal attempts when creating or renaming a custom code version, an exception is thrown on any attempts to access a parent directory or sub-directory. For example, you can't pass `my/new/version` when creating or renaming a custom code version. The effective version name is the end of the expression, in this case, `version`. This type of input results in an error.
11. To configure the number of retained code versions:
1. Click App Launcher  and then select **Administration > Site Development > Code Deployment** (admin user only).
2. In the Code Version Retention section, enter the number of retained code versions (3 to 20, the default is 10).
The initial value for existing customers is 0, which means that the feature is disabled. If you activate this feature (by setting a value other than 0) only Salesforce Support can reset it to 0. All newly provisioned instances have a default of 10.
3. Click **Apply**.
12. To work with a single version:
1. Click the code version name link.
The Code Version Summary page opens.
This page provides a detailed view of the code version. The top section provides summary information, while the bottom section provides a paged list view of resources that are part of the code version. The list view shows files regardless of where they are located within the code version (that is, regardless of cartridge and subdirectory).
2. Click **Activate** to activate this code version.
3. Click **Download** in the top section to download the entire code version, or click **Download** beside an individual file to download that file.
4. Use the File Filter to search for a file or set of files.
## Code Version Best Practices
As a best practice, maintain consistent use of version numbers for each software update.
It is tempting to simply upload a fix to a current production directory. But if there are problems, this approach doesn't permit quick roll backs. This approach can also cause unnecessary delays in addressing a potentially critical situation.
Using version numbers consistently helps development and support teams diagnose and fix issues in a timely manner. If a new version causes issues that were unknown during the test phase, support can roll back to a previous known working version. Being able to roll back is especially helpful if a version makes the system unstable and support is required to respond in a 24x7 environment. With versioning, the development team can review specific code fixes within the context of multiple previous versions.
## Compatibility Modes
_Compatibility mode_ refers to a B2C Commerce API version that includes changes that affect backward compatibility with the previous API version.
Not every API version affects backward compatibility, so only some API versions have a compatibility mode. Use API versioning to actively select from multiple compatibility modes, with the full knowledge and acceptance of incompatible changes. Select the compatibility mode to maintain your customizations on a previous compatibility mode, while B2C Commerce introduces new functionality in one or more newer compatibility modes.
Selectable compatibility modes are newer than the active compatibility mode, in addition to the previously active compatibility mode. You can't select a compatibility mode that is older than the previously active one.
**note:** Not every release introduces an API version or compatibility mode. We try to keep the number of API compatibility modes to a maximum of two per year.
B2C Commerce supports a single _active_ compatibility mode; and maintains a reference to the previously active compatibility mode, to which you can revert, if necessary.
The complete list of compatibility modes available at any time consists of:
- The currently active compatibility mode
- The previously active compatibility mode
- Any new compatibility modes you can activate
When your system was initially provisioned, the active compatibility mode was set to the latest (or most recent) compatibility mode. For example, if you initially provisioned with version 2.10.6, then the active compatibility mode is 2.10.6 because 2.10.6 introduced a corresponding 2.10.6 API version (compatibility mode).
Specify how many code versions to retain. The oldest, except for the active and previously active code versions, are automatically removed by B2C Commerce (Sandboxes only).
### API Documentation
A single API documentation set describes multiple compatibility modes at the class and method level, and potentially multiple compatibility modes for certain methods.
### When Do You Need to Change Your Application?
Before activating a new compatibility mode, it's important that you understand the behavioral changes the new mode brings. If the change impacts your application, you might need to modify your application to make it function correctly with the changes and then test. Roll back to the previously active compatibility mode only if your code is compatible with the old mode (API version). If you write code that takes advantage of the API of a newer version that is incompatible with the old version, roll back only if you also revert the respective code.
When using API versioning, you must pay close attention to certain situations:
- All cartridges in an application must use the same active compatibility mode.
- There can be only one active compatibility mode at a time (no wildcard support).
- Change the compatibility mode on all instances, but we don't recommend changing the mode directly on Production.
- Avoid using different compatibility modes on Staging and Production.
## Configure Secure Code Uploads
To upload code securely, use two-factor authentication to upload the code to the staging instance. After the code is on the staging instance, use code replication to propagate the code from staging to the production instance.
For a human user, use a Business Manager or Account Manager username and password as the first factor for uploading to staging. For an automated script, use Account Manager to get an authorization token for a Client ID and use that as the first factor. See [OCAPI OAuth 2.0](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-commerce-ocapi/oauth.html) for details about authenticating an API client. The second factor of authentication for code uploads to staging is always a client certificate. To enforce this process of secure uploads, make sure that your configuration requires two-factor authentication for uploading code to the staging instance, and disallows code uploads to the production instance. As of August 1, 2020, Salesforce mandates these settings.
1. See if two-factor authentication is required for uploading code to your staging instance and enable if necessary:
1. Log in to Business Manager on the staging instance as a user with administrative privileges.
2. Click App Launcher  and then select **Administration** > **Site Development** > **Development Setup**.
3. Look at the status message under **WebDAV Access, Cartridges**.
If the message is **A client certificate is required to upload code to this instance type**, two-factor authentication is already enabled. If the message is **A client certificate isn't required to upload code to this instance**, two factor-authentication isn’t enabled and you must enable it, as described in the next step.
4. To enable two-factor authentication, click App Launcher  and then select **Administration** > **Global Preferences** > **Security** > **Access Restriction** and select **Require client certificate for code uploads**.
When you require the client certificate for code uploads, the option to configure this setting is no longer available in Business Manager. Only Salesforce Customer Support can revert the setting.
2. See if code uploads are allowed to your production instance and disallow if necessary:
1. Log in to Business Manager on the production instance as a user with administrative privileges.
2. Click App Launcher  and then select **Administration** > **Site Development** > **Development Setup**.
3. Look at the status message under **WebDAV Access, Cartridges**.
If the message is **Uploading code to this instance type isn't allowed**, code uploads are disallowed to the production instance. If the message is **Uploading code to this instance type is allowed**, code uploads are allowed to production and you must disallow uploads, as described in the next step.
4. To disallow code uploads, click App Launcher  and then select **Administration** > **Global Preferences** > **Security** > **Access Restriction** and select **Disallow code uploads**.
When you disallow code uploads, the option to configure this setting is no longer available in Business Manager. Only Salesforce Customer Support can revert the setting.
## Deploy and Replicate Code
Use Business Manager to replicate code from Staging to Production.
1. Make sure you have the current updated version of the API on which the instance is running.
1. Make sure that deprecated APIs are accounted for in your application. (Check the `WebDav/Sites/Logs/deprecation/` directory on your server for a full list of deprecated APIs in use.) This makes sure that references to deprecated APIs are removed before the API is discontinued.
2. Make sure that any sandbox used for site development is upgraded at the same time as the Primary instances.
2. Merge code in the code repository.
3. Retrieve the collective changes from the code repository, then deploy the code to a Build/Merge instance.
4. Use Business Manager to create a new B2C Commerce version directory on the Staging and Development instances.
1. Click App Launcher  and then select **Administration** > **Site Development** > **Code Deployment**.
2. Select an active version for these instances.
5. Provide a readme.txt file in the cartridge that lists the code fixes/enhancements in this version.
6. Copy the cartridge to the newly created version directories on Staging and Development via WebDav.
7. Test the new version (see above consideration).
8. Push the newly tested version to the Production instance for live usage. Use Business Manager to push code from Staging to Production. Click App Launcher  and then select **Administration** > **Replication** > **Code Replication**. The replication process takes the current active version directory, creates the same version directory, then copies the cartridge code from Staging to Production.
**important:** You _must_ follow these steps for each version that is being replicated from Staging to Development and from Staging to Production. If any change, no matter how insignificant, is made to a site, it must be delivered via a version change. A new version must be created, even if it's intended to find or fix an issue that occurs with a new version, so that if a problem exists, the site can be rolled back to a known working version as quickly as possible.
## Generate, Sign, and Use Client Certificates for Secure Code Uploads
Two-factor authentication to upload code securely to the staging instance requires a username and password or authentication token as one factor and a client certificate as the second factor. Generate the client certificate and sign it with a key provided by Salesforce. Generate multiple client certificates with different expiration dates.
You must have a B2C Commerce `Certificate.zip` file to complete this procedure. Salesforce typically provides the `Certificate.zip` file as part of the realm provisioning request. Request a `Certificate.zip` file from Salesforce Customer Support if needed.
**important:** Before performing the steps in this section, make sure that your certificate is valid. Otherwise, when you attempt to upload the pkcs12 file, you will receive a `ca key too small` error. If this happens, request a new Certificate.zip file from Salesforce Customer Support.
The `Certificate.zip` file contains the following files:
- `{\}.key`
- `{\}.crt`
- `{\}.srl`
- `{\}.txt`
_\_ is a unique identifier that reflects your instance or company name, plus a serial number. For `{\}.srl` only, the serial number isn't included in the file name.
The `{\}.txt` file contains the passphrase used to access the key. You must provide this passphrase every time you sign a key request.
The files in `Certificate.zip` are highly sensitive. A best practice is to provide the files to only a single trusted employee within your organization, typically the administrator of your B2C Commerce instances.
1. If you're using Windows, install OpenSSL on your machine.
If you're using MacOS or Unix operating system, you don't have to install OpenSSL. OpenSSL is provided as part of the operating system.
1. Download a Windows OpenSSL client from the following location: [http://www.slproweb.com/products/Win32OpenSSL.html](http://www.slproweb.com/products/Win32OpenSSL.html)
2. Accept the default installation instructions. OpenSSL is installed to `C:\OpenSSL`.
These instructions assume the default installation location.
2. Create a certificate request.
1. Unzip the `Certificate.zip` file.
If you're using Windows, unzip the contents of the file to the `C:\OpenSSL\bin` directory. If you're using MacOS or a Unix operating system, use any directory of your choice.
2. Navigate to the directory where you unzipped the contents of `Certificate.zip`.
3. To generate a request, enter the following command: `openssl req -new -sha256 -newkey rsa:2048 -nodes -out {\}.req -keyout {\}.key`
Salesforce B2C Commerce doesn't support client certificates with key length less than 1024 bits. We recommend that you use client certificates with at least a 2048-bit length. _\_ is the user that this key is for. We recommend that _\_ be the same as the corresponding Business Manager user. For example, if the B2C Commerce instance username is `jsmith`, use `jsmith` for the certificate user. Don't use a generic name like `Release Team`.
The result of this step is similar to the following:
```
Generating a 2048 bit RSA private key
....................
++++++++++++
........
++++++++++++
writing new private key to 'user.key'
-----
you're about to be asked to enter information that will be incorporated into your certificate request.
What you're about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (city) []:
Organization Name (company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (section) []:
Common Name (YOUR name) []:
Email Address []:
Enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
```
4. When prompted, provide your location and name information and the email address of the person using the certificate.
We recommend that you leave the challenge password and optional company name blank. The challenge password isn't used.
For example:
```
Country Name (2 letter code) [AU]: *US*
State or Province Name (full name) [Some-State]: `Massachusetts`
Locality Name (city) []:
Organization Name (company) [Internet Widgits Pty Ltd]: `B2C Commerce`
Organizational Unit Name (section) []: `Customer Services`
Common Name (YOUR name) []: `John Smith`
Email Address []: `jsmith@salesforce.com`
Enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
```
OpenSSL creates files named `{\}.req` and `{\}.key`, in the same directory where the contents of the `Certificate.zip` file are stored.
3. Sign the certificate request (`{\}.req`) with your certificate.
1. Enter the following command at the command prompt: `openssl x509 -CA {\}.crt -CAkey {\}.key -CAserial {\}.srl -req -in {\}.req -out {\}.pem -days {\}`
- _\_ is the number of days you want this client certificate to be valid.
- _\_ is the unique identifier provided by Salesforce, as reflected in the file names in the `Certificate.zip` file.
- _\_ is the user of the client certificate you're signing.
For example:
`openssl x509 -CA cert.staging.web.customer.demandware.net_01.crt -CAkey cert.staging.web.customer.demandware.net_01.key -CAserial cert.staging.web.customer.demandware.net.srl -req -in jsmith.req -out jsmith.pem -days 10`
The result of this step is similar to the following:
```
Signature ok
subject=/C=XX/ST=XX/L=XX/O=XX/OU=XX/CN=XX/emailAddress=user@co.com
Getting CA Private Key
Enter pass phrase for name.key:
```
2. Enter the passphrase contained in `{\}.txt` in the `Certificate.zip` file to sign the certificate.
4. Export the certificate and client information to pkcs12 format.
1. Enter the following command: `openssl pkcs12 -export -in {\}.pem -inkey {\}.key -certfile {\}.crt -name "{\}" -out {\}.p12`
- _\_ is the unique identifier provided by Salesforce.
- _\_ is the user of the client certificate you're signing.
For example:
`openssl pkcs12 -export -in jsmith.pem -inkey jsmith.key -certfile cert.staging.web.customer.demandware.net_01.crt -name "jsmith" -out jsmith.p12`
The system prompts for an export password for the file.
2. Specify an export password.
Provide the export password to the person who uses the certificate.
The system creates files named `{\}.pem` and `{\}.p12` in the same directory where the contents of the `Certificate.zip` file are stored. Use the `{\}.p12` file to connect to a staging instance with UX Studio, as described in the next step. Use other WebDAV clients such as the Windows built-in WebDAV client, or third-party tools such as Cyberduck.
5. To connect to a staging instance with UX Studio, create a server connection.
1. Open UX Studio and click **File** > **New** > **Digital Server Connection**.
2. Enter the new instance URL as `cert.staging.{\}.{\}.demandware.net`.
3. Click the **Use Certificate Authentication** check box.
4. Browse to the `{\}.p12` file and click **Select**.
5. Enter the export password for the `{\}.p12` file.
6. Click **Finish**.
If there is a proxy server between UX Studio and your instance, test your connection. If you can't connect to your staging instance, install the certificate on the proxy server. See your proxy server documentation for more information on uploading certificates.
7. If you have to extract the certificate from the pkcs12 file before uploading it to the proxy server, enter `openssl pkcs12 -in {\}.p12 -clcerts -out {\}.cer`
- _\_ is the user of the client certificate.
For example:
```
openssl pkcs12 -in jsmith.p12 -clcerts -out jsmith.cer
```
OpenSSL prompts you for the password on the pks12 file.
## Generate, Sign, and Use Client Certificates for Secure Code Uploads (Hyperforce)
The following procedure only applies to Hyperforce B2C Commerce environments. It uses a customer-generated CA certificate and the standard staging hostname. If your realm uses the legacy Salesforce-provided `Certificate.zip` and the `cert.staging.*` hostname, use the procedure in [Generate, Sign, and Use Client Certificates for Secure Code Uploads](#generate-sign-and-use-client-certificates-for-secure-code-uploads) instead.
Two-factor authentication to upload code securely to the staging instance requires a username and password or authentication token as one factor and a client certificate as the second factor. In Hyperforce, you generate your own CA (Certificate Authority) certificate, upload it to eCDN, then sign client certificates with that CA. You can generate multiple client certificates with different expiration dates.
**note:** Hyperforce changes two-factor code upload because code uploads use the standard Business Manager staging hostname, for example, `staging--.demandware.net` or your realm-specific hostname. There's no separate hostname for code uploads. The legacy `cert.staging...demandware.net` pattern is deactivated for Hyperforce. Regular Business Manager login doesn't require a client certificate, and the client certificate is only required for **code uploads** (and related WebDAV operations). Salesforce doesn't receive or store your CA bundle—you generate and register it with eCDN yourself. Initial upload and **rotation** of the CA are self-service. The CA certificate bundle has a maximum validity of 365 days.
Before and after migration: Until your realm has migrated to Hyperforce, continue to use existing client certificates with the legacy `cert.staging` hostname if applicable. After migration, generate new client certificates signed by your uploaded CA and use the standard Business Manager hostname.
### 1. Generate your CA Certificate and Private Key
You must create a self-signed CA certificate bundle yourself. Salesforce does not provide a `Certificate.zip` for Hyperforce. The platform accepts client certificates signed by a CA that you upload to eCDN.
1. If you're using Windows, install OpenSSL on your machine. On macOS or Unix, OpenSSL is typically provided by the operating system.
- Windows: Download from [Win32 OpenSSL](http://www.slproweb.com/products/Win32OpenSSL.html) and accept the default installation (for example, `C:\OpenSSL`).
2. Set a host identifier and generate the CA certificate and private key. A common choice is to align `${CERT_HOST}` with your staging hostname, replacing `` and `` with your values:
```bash
CERT_HOST=staging--.demandware.net
openssl req -new -newkey rsa:2048 -sha256 -days 365 -x509 -nodes -keyout ${CERT_HOST}.key -out ${CERT_HOST}.crt
```
When prompted, enter the Distinguished Name (DN) details for your CA. For **Common Name**, use the same value as `${CERT_HOST}` (for example, `staging-realm-customer.demandware.net`). Leave the challenge password and optional company name blank if you don't need them.
This produces:
- `${CERT_HOST}.key` — CA private key (keep this secure).
- `${CERT_HOST}.crt` — CA certificate (you will upload this to eCDN along with the key).
B2C Commerce doesn't support client certificates with key length less than 1024 bits. Use at least 2048-bit keys for the CA and for client certificates. The CA certificate can't exceed **365 days** validity.
### 2. Upload the CA Certificate to eCDN
Upload your self-generated CA certificate and private key to eCDN so the platform will accept client certificates signed by your CA.
**Option 1 — Business Manager**
1. Log in to Business Manager on your **staging** instance.
2. Click App Launcher  and go to **Administration** > **Site Development** > **Code Upload Certificate** (tab).
3. Click **Add Certificate**. Enter a **Certificate Name** (for your own organization), then paste the **Certificate** and **Private Key** contents from the `.crt` and `.key` files you generated, and save.
After you save, eCDN is configured to accept client certificates signed by this CA.
**(Optional) Remove unused or expired CAs:** Multiple CA certificates can be active at the same time. You can delete unused, expired, or compromised CA certificates from the same **Code Upload Certificate** page.


**Option 2 — CDN API**
Use the Commerce CDN API to upload, list, and delete code-upload CA certificates programmatically. You need an API client with the correct OAuth scopes and an access token for the **Authorization** header. You can send requests with `curl`, Postman, or another HTTP client.
#### Format the Certificate and Private Key for the API Request Body
The CDN API expects the certificate and private key as **single-line strings** in JSON, with **literal** `\n` characters where line breaks were in the PEM file.
From a shell (example using Perl):
```bash
cat ${CERT_HOST}.crt | perl -pe 's/\n/\\n/g'
cat ${CERT_HOST}.key | perl -pe 's/\n/\\n/g'
```
Or use a text editor that supports regular expressions (for example, Sublime Text):
1. Open the `.crt` file.
2. Open **Find** → **Replace**.
3. Enable **Regular expression** mode.
4. **Find:** `\n` — **Replace:** `\\n`
5. Click **Replace All**, then save. Repeat for the `.key` file.
Use the reformatted strings as the `certificate` and `privateKey` values in the JSON body (keep `-----BEGIN CERTIFICATE-----` / `-----END CERTIFICATE-----` and `-----BEGIN PRIVATE KEY-----` / `-----END PRIVATE KEY-----` boundaries as required by the API).
#### Obtain an Access Token
Follow [Authorization for SCAPI Admin APIs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-admin-apis.html) to authenticate your API client. The OAuth scope required for CDN API calls that manage code-upload certificates includes **`sfcc.cdn-zones.rw`**.
Reference example (client credentials)—replace ``, ``, and `` with your values:
```bash
curl "https://account.demandware.com/dwsso/oauth2/access_token" \
--request POST \
--user ":" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=client_credentials" \
--data-urlencode "scope=SALESFORCE_COMMERCE_API:_stg sfcc.cdn-zones.rw"
```
#### Upload the CA Certificate (Create)
Replace ``, ``, and the bearer token with your values. Replace `certificate` and `privateKey` with the reformatted strings from the previous step.
```bash
curl --location "https://.api.commercecloud.salesforce.com/cdn/zones/v1/organizations/f_ecom__stg/mtls/code-upload-certificates" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer " \
--data '{
"name": "client ca for code upload",
"certificate": "-----BEGIN CERTIFICATE-----\n\n-----END CERTIFICATE-----",
"privateKey": "-----BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY-----"
}'
```
#### List Code Upload Certificates
Use a **GET** request to retrieve existing certificates (including `mtlsCertificateId` values for deletes):
```bash
curl --location "https://.api.commercecloud.salesforce.com/cdn/zones/v1/organizations/f_ecom__stg/mtls/code-upload-certificates" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer "
```
#### Delete a Code Upload Certificate
Use the `mtlsCertificateId` from the list response. Example:
```bash
curl --location --request DELETE "https://.api.commercecloud.salesforce.com/cdn/zones/v1/organizations/f_ecom__stg/mtls/code-upload-certificates/" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer "
```
#### CDN API Troubleshooting
- 401 Unauthorized or 403 Forbidden: Confirm the API client default and allowed scopes. Default scopes often include values such as `mail`, `roles`, `tenantFilter`, `profile`, and `openId`. Allowed scopes must include `sfcc.cdn-zones` and `sfcc.cdn-zones.rw`. Verify the client ID, secret, and token request.
- Certificate can't be parsed: Recheck PEM-to-JSON formatting (literal `\n` only). Confirm the certificate and private key are a matching pair using a certificate/key matcher tool in **original** PEM file form (not the JSON-escaped form)—for example, [SSL Checker matcher](https://www.sslchecker.com/matcher).
### 3. Create a client certificate request
Create one client certificate **per user** who uploads code; each can be signed with the same CA.
1. Navigate to a working directory (for example, the same folder as your CA files, or a dedicated directory for client certs).
2. Generate a client certificate request and private key. Use `` as the Business Manager username (for example, `jsmith`). You can set `USER=` in your shell and use `${USER}` in place of `` in the file names as shown in this example. Run:
```bash
openssl req -new -sha256 -newkey rsa:2048 -nodes -out .req -keyout .key
```
When prompted, enter location, name, and email. We recommend leaving the challenge password and optional company name blank. OpenSSL creates `.req` and `.key`.
### 4. Sign the Client Certificate with Your CA
Sign the client request using your CA certificate and key (the same `${CERT_HOST}` used in step 1). OpenSSL will create or update a serial file (for example, `${CERT_HOST}.srl`) when you sign. Run:
```bash
openssl x509 -CA ${CERT_HOST}.crt -CAkey ${CERT_HOST}.key -CAcreateserial -req -in .req -out .pem -days
```
- _\_ is the number of days the client certificate is valid.
- If you already have a serial file, you can use `-CAserial ${CERT_HOST}.srl` instead of `-CAcreateserial`.
Example (CA named `mycompany-ca`, user `jsmith`, valid 365 days):
```bash
openssl x509 -CA mycompany-ca.crt -CAkey mycompany-ca.key -CAcreateserial -req -in jsmith.req -out jsmith.pem -days 365
```
If your CA key was created with a passphrase, OpenSSL will prompt for it.
### 5. Export the Signed Certificate to PKCS#12 (.p12)
Export the signed client certificate and key to a `.p12` file for use with UX Studio or other WebDAV clients.
**note:** You must include the `-legacy` flag so that newer versions of OpenSSL produce a `.p12` file that can be imported into Mac keychains and other tools.
```bash
openssl pkcs12 -export -legacy -in .pem -inkey .key -certfile ${CERT_HOST}.crt -name "" -out .p12
```
Example:
```bash
openssl pkcs12 -export -legacy -in jsmith.pem -inkey jsmith.key -certfile mycompany-ca.crt -name "jsmith" -out jsmith.p12
```
Specify an export password when prompted and provide it to the person who will use the certificate. You can use the `.p12` file to connect to your staging instance with UX Studio or other WebDAV clients (for example, Cyberduck).
### 6. Connect to the Staging Instance
Use the standard Business Manager staging hostname for your realm, for example, `staging-na01-.demandware.net`. Don't use the legacy `cert.staging...demandware.net` hostname. That hostname is deactivated for Hyperforce.
1. Open UX Studio and click **File** > **New** > **Digital Server Connection**.
2. Enter the instance URL using your standard staging hostname (for example, `https://staging-na01-.demandware.net`).
3. Select **Use Certificate Authentication** and browse to the `.p12` file.
4. Enter the export password for the `.p12` file and click **Finish**.
If a proxy sits between UX Studio and your instance, you may need to install the client certificate on the proxy. To extract the certificate from the `.p12` file for proxy or other use:
```bash
openssl pkcs12 -in .p12 -clcerts -out .cer
```
OpenSSL will prompt for the `.p12` export password.
### 7. Rotate or Renew the CA Certificate
The CA certificate bundle is limited to a maximum of one year (365 days). Before it expires, generate and upload a new CA so code uploads aren't interrupted. Follow the same procedure if the CA private key or any client certificate signed by it may have been compromised.
1. Generate a new self-signed CA (new `${CERT_HOST}` or new files) and upload it using Business Manager or the CDN API, following **Upload the CA certificate to eCDN** earlier in this topic.
2. Overlap is supported: Multiple CA bundles can be active at the same time. Keep the old CA active while you issue new client certificates signed by the new CA and confirm code uploads work with the standard staging hostname.
3. Re-sign users: Each user needs a new `.p12` signed by the new CA. Repeat **Create a client certificate request**, **Sign the client certificate with your CA**, and **Export the signed certificate to PKCS#12 (.p12)** using the new `${CERT_HOST}.crt` and `.key`.
4. After all users have switched and you have validated uploads, remove the old CA on the **Code Upload Certificate** page in Business Manager, or call the CDN API `DELETE` endpoint with the old certificate's `mtlsCertificateId`.
## Collaborative Development and Deployment
The Salesforce B2C Commerce architecture supports multiple Sandbox instances where individual developers can work on discrete portions of an application, making efficient use of resources. At release time, developers file their changes back into a source control system for consolidation and testing.
Eclipse comes with a built-in client for the Concurrent Versions System (CVS). Use another system, such as Subversion (SVN) for your code repository. Many code repository/version control systems use a branch model to support multiple courses of work that are somewhat isolated from each other, yet still highly interdependent. This model supports individuals working on a team project, sharing their work with others as changes are made, and accessing the work of others as the project evolves. As team members produce new work, they share their work by committing their changes to the branch. Similarly, when they want to get the latest available work, they update their local workspaces to the changes on the branch. Thus the branch is constantly changing, moving forward as team members submit new work.
As a B2C Commerce development team member, it is important that you implement both a code repository/version control system and a versioning plan that follows a standard process. This process includes deploying/replicating code from the developer's sandbox instance to various other instances for integration and testing, and final deployment to Production.
## Software Deployment Stages
The software deployment stages for B2C Commerce development include Sandbox, Build and Merge, Staging, Development, and Production.
The following table describes the software deployment stages :
| Instance | Description | Considerations |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Sandbox | Each development team gets one sandbox per developer and one sandbox to be used as a Build/Merge instance. | Each developer is responsible for their own sandbox, where they build code, metadata, custom objects. |
| Build/Merge | As a project progresses and interval version points are reached, developers merge their code/data on a Build/Merge instance, where internal QA is done. | Designate one of your sandbox instances as the Build/Merge instance, specifically for testing major releases. This means that of the three sandbox instances provided for in a subscription, only two can be used by individual developers. |
| Staging | As development continues, builds are moved from the Build/Merge instance to the Staging instance, where they are replicated to the Development instance for internal/external QA. | Major releases _can't_ be tested on the Staging, because they can include incompatible data definitions. Therefore, data replication _can't_ be performed to the Production instance during the test phase. |
| Development | Some customers use the Development instance to test the data and code replication process before replicating to Production. Others use the Development instance as a secondary Staging instance, where another version is prepared in parallel. | When new code versions include changes to object or preference definitions or introduce new sites or catalogs, they _can't_ be created and tested on a Development instance. This disqualifies the Development instance for the testing of major releases. |
| Production | When testing is complete, the release is pushed to the Production instance. | Having the same version on Development as on Production lets Support and Solution Support Engineers use the Development version for testing if problems occur on Production. |
This process is repeated as the development cycle continues. The development team must determine (based on the number and severity of bugs outstanding):
- When an internal build is ready to be deployed to the Build/Merge instance.
- When the build is ready to be pushed to Staging for replication.
- When the build is ready for Production.
# Command-Line Interface (CLI) Reference
The `sfnext` CLI is your primary tool for developing and deploying Storefront Next projects. It's provided by the `@salesforce/storefront-next-dev` package, which is installed as a project dependency—not globally.
## Running CLI Commands
### Using Project `package.json` Scripts
Storefront Next projects include pre-configured scripts in `package.json` for common tasks:
```bash
pnpm dev # Start the development server
pnpm build # Create a production build
pnpm start # Preview the production build locally
pnpm push # Deploy to Managed Runtime
```
### Running Commands Directly
For commands that don't have a `package.json` script, or when you need to pass specific options, run `pnpm sfnext` from your project's root directory:
```bash
pnpm sfnext [options]
```
For example:
```bash
pnpm sfnext dev --port 3000
pnpm sfnext extensions list
```
You can also view all available commands and options:
```bash
pnpm sfnext --help
pnpm sfnext --help
```
This works because `pnpm` automatically resolves binaries installed in your project's `node_modules/.bin`. Running `sfnext` this way ensures the CLI version always matches your project's dependencies.
**important:** Don’t install `@salesforce/storefront-next-dev` globally. Always run commands from within your project directory so that the CLI version stays in sync with your dependencies.
### Creating a Storefront Without a Project
The `create-storefront` command is the one exception—it runs _before_ a project exists, so there's no local `node_modules` to resolve from. For this command, use `pnpm dlx` to download and execute the package directly:
```bash
pnpm dlx @salesforce/storefront-next-dev create-storefront
```
For all other commands, use `pnpm sfnext` from within your project.
## Commands
| Command | package.json Script | Description |
| ----------------------------------------- | ------------------- | ---------------------------------------------------------- |
| [`create-storefront`](#create-storefront) | — | Scaffold a new storefront project from a template. |
| [`dev`](#dev) | `pnpm dev` | Start the development server with hot module replacement. |
| [`preview`](#preview--start) | `pnpm start` | Preview a production build locally. |
| [`push`](#push) | `pnpm push` | Build a bundle and deploy it to Managed Runtime. |
| [`create-bundle`](#create-bundle) | — | Create a deployment bundle without pushing. |
| [`extensions`](#extensions) | — | Manage feature extensions (install, remove, create, list). |
## `create-storefront`
Scaffold a new Storefront Next project. The command clones a template repository, walks you through extension selection, and configures your environment variables.
Because this command creates a new project, it's the one CLI command you run _before_ a project exists. Use `pnpm dlx` to download and run it without a prior installation:
```bash
pnpm dlx @salesforce/storefront-next-dev create-storefront [options]
```
### Options
| Option | Description |
| -------------------------------- | ---------------------------------------------------------------------------------------------- |
| `-n, --name ` | Name for the storefront. Skips the interactive prompt. |
| `-t, --template ` | Template URL or local path (for example, a GitHub URL or `file:///path/to/template`). |
| `-l, --local-packages-dir ` | Local monorepo packages directory. Used with `file://` templates to pre-fill dependency paths. |
| `-v, --verbose` | Enable verbose output. |
### Examples
Create a storefront interactively:
```bash
pnpm dlx @salesforce/storefront-next-dev create-storefront
```
Create a storefront with a specific name:
```bash
pnpm dlx @salesforce/storefront-next-dev create-storefront --name my-storefront
```
After the command completes, follow the on-screen instructions to install dependencies and start developing:
```bash
cd my-storefront
pnpm install
pnpm build
pnpm dev
```
For a walkthrough of creating a storefront with the CLI, see [Explore Storefront Next Code Locally](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-quick-start-create-sf.md).
## `dev`
Start a local development server powered by Vite with full server-side rendering (SSR) support. The server includes hot module replacement (HMR) for both client and server code, and an API proxy to B2C Commerce.
```bash
pnpm dev
```
Or with options:
```bash
pnpm sfnext dev [options]
```
### Options
| Option | Description | Default |
| ------------------------------- | ------------------------------- | ----------------- |
| `-d, --project-directory ` | Path to the project directory. | Current directory |
| `-p, --port ` | Port number for the dev server. | `5173` |
### Examples
Start the dev server:
```bash
pnpm dev
```
Start the dev server on a custom port:
```bash
pnpm sfnext dev --port 3000
```
Start with the Node.js debugger attached:
```bash
pnpm dev:debug
```
### What the Dev Server Does
- Runs Vite in middleware mode within an Express server for full SSR support.
- Proxies B2C Commerce API requests through `/mobify/proxy/api` so that you can develop against live data without CORS issues.
- Loads environment variables from your `.env` file.
- Prints your Commerce API configuration (short code, organization ID, site ID) at startup.
## `preview` / `start`
Start a local server that serves your production build. Use this to test production behavior before deploying. If no build exists, the command automatically runs `pnpm build` first.
The CLI command is `preview`. In `package.json`, it's mapped to `pnpm start`.
```bash
pnpm start
```
Or with options:
```bash
pnpm sfnext preview [options]
```
### Options
| Option | Description | Default |
| ------------------------------- | ----------------------------------- | ----------------- |
| `-d, --project-directory ` | Path to the project directory. | Current directory |
| `-p, --port ` | Port number for the preview server. | `3000` |
### Examples
Preview the production build:
```bash
pnpm start
```
Preview on a custom port:
```bash
pnpm sfnext preview --port 8080
```
### How Preview Differs from Dev
| Feature | `dev` | `preview` |
| -------------------- | -------------------------------- | ---------------------------- |
| Build type | On-the-fly via Vite | Pre-built production bundle |
| HMR | Yes | No |
| Static asset serving | Vite handles | Express with compression |
| Performance | Optimized for speed of iteration | Reflects production behavior |
## `push`
Create a deployment bundle from your production build and push it to Managed Runtime (MRT). You must build your project before running this command.
```bash
pnpm push
```
Or with options:
```bash
pnpm sfnext push [options]
```
### Options
| Option | Description | Default |
| ----------------------------- | ------------------------------------------------- | --------------------------------------------------- |
| `--project-directory ` | Path to the project directory. | Current directory |
| `-b, --build-directory ` | Path to the build output directory. | Auto-detected |
| `-m, --message ` | Descriptive message for the bundle. | `git branch:commit` |
| `-p, --project ` | Unique project identifier on Managed Runtime. | From `SFCC_MRT_PROJECT` or `MRT_PROJECT` env var |
| `-e, --environment ` | Target environment to deploy to. | From `SFCC_MRT_ENVIRONMENT` or `MRT_TARGET` env var |
| `-w, --wait` | Wait for the deployment to finish before exiting. | `false` |
| `--api-key ` | API key for MRT authentication. | From `SFCC_MRT_API_KEY` env var |
| `--credentials-file ` | Path to the MRT credentials file. | From `MRT_CREDENTIALS_FILE` env var |
| `--cloud-origin ` | MRT API origin URL. | Production default |
| `--config ` | Path to `dw.json` config file. | Auto-discovered from project directory |
| `-i, --instance ` | Named instance from config file. | From `SFCC_INSTANCE` env var |
### Authentication
Authenticate with Managed Runtime using one of these methods:
- **Credentials file** (default): The CLI reads stored credentials automatically. Use `--credentials-file` to specify a custom path.
- **API key**: Pass `--api-key` on the command line or set the `SFCC_MRT_API_KEY` environment variable.
### Setting Up MRT Resources
Before you can deploy, you need a Managed Runtime project and SLAS client credentials. Use the [B2C CLI](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/storefront-next.html#storefront-next) to create these resources.
### Examples
Build and deploy to MRT:
```bash
pnpm build
pnpm push
```
Deploy to a specific environment and wait for completion:
```bash
pnpm sfnext push --environment staging --wait
```
Deploy with an API key:
```bash
pnpm sfnext push --api-key your-api-key
```
## `create-bundle`
Create a deployment bundle and save it to disk without pushing to Managed Runtime. This is useful for inspecting bundle contents or integrating with custom deployment pipelines.
```bash
pnpm sfnext create-bundle -d [options]
```
### Options
| Option | Description | Default |
| ------------------------------- | --------------------------------------------- | ------------------------------------------------ |
| `-d, --project-directory ` | **(Required)** Path to the project directory. | |
| `-b, --build-directory ` | Path to the build output directory. | Auto-detected |
| `-o, --output-directory ` | Directory where bundle files are written. | `.bundle` |
| `-m, --message ` | Descriptive message for the bundle. | `git branch:commit` |
| `-s, --project-slug ` | Unique project identifier on Managed Runtime. | From `.env` `MRT_PROJECT` or `package.json` name |
### Output
The command generates two files in the output directory:
- `bundle.tgz` — The compressed deployment bundle.
- `bundle.json` — Bundle metadata (message, SSR parameters, file sizes).
### Example
```bash
pnpm build
pnpm sfnext create-bundle -d . -o ./my-bundle
```
## `extensions`
Manage feature extensions for your storefront project. Extensions add pre-built functionality, such as store locators or theme switchers.
```bash
pnpm sfnext extensions [options]
```
### `extensions list`
List all extensions currently installed in your project.
```bash
pnpm sfnext extensions list [options]
```
| Option | Description | Default |
| ------------------------------- | ------------------------------ | ----------------- |
| `-d, --project-directory ` | Path to the project directory. | Current directory |
#### Example
```bash
pnpm sfnext extensions list
```
### `extensions install`
Install an extension from a source template repository. The CLI clones the source repository, lets you select an extension, and copies the extension files into your project.
```bash
pnpm sfnext extensions install [options]
```
| Option | Description | Default |
| ------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `-d, --project-directory ` | Path to the target project directory. | Current directory |
| `-e, --extension ` | Extension marker value to install (for example, `SFDC_EXT_STORE_LOCATOR`). Skips the interactive prompt. | |
| `-s, --source-git-url ` | Git URL of the source template that contains extensions. | Default Storefront Next template |
| `-v, --verbose` | Enable verbose output. | |
If the extension has dependencies on other extensions, the CLI detects them and installs the full dependency chain in the correct order.
#### Examples
Install an extension interactively:
```bash
pnpm sfnext extensions install
```
Install a specific extension by marker:
```bash
pnpm sfnext extensions install -e SFDC_EXT_STORE_LOCATOR
```
### `extensions remove`
Remove one or more installed extensions from your project. The CLI automatically detects and removes dependent extensions.
```bash
pnpm sfnext extensions remove [options]
```
| Option | Description | Default |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `-d, --project-directory ` | Path to the project directory. | Current directory |
| `-e, --extensions ` | Comma-separated list of extension markers to remove (for example, `SFDC_EXT_STORE_LOCATOR,SFDC_EXT_THEME_SWITCHER`). Skips the interactive prompt. | |
| `-v, --verbose` | Enable verbose output. | |
#### Example
Remove extensions interactively:
```bash
pnpm sfnext extensions remove
```
Remove specific extensions by marker:
```bash
pnpm sfnext extensions remove -e SFDC_EXT_STORE_LOCATOR
```
### `extensions create`
Scaffold a new extension in your project. This command creates the extension directory structure with placeholder folders for components, hooks, locales, and routes.
```bash
pnpm sfnext extensions create [options]
```
| Option | Description | Default |
| --------------------------------- | ------------------------------------------------------ | ----------------- |
| `-p, --project-directory ` | Path to the project directory. | Current directory |
| `-n, --name ` | Name of the extension (for example, `"My Extension"`). | |
| `-d, --description ` | Description of the extension. | |
#### Example
```bash
pnpm sfnext extensions create --name "Store Locator" --description "Find nearby stores"
```
The generated directory structure:
```
src/extensions/store-locator/
components/
hooks/
locales/
routes/
README.md
```
## Environment Variables
Several CLI commands read configuration from environment variables defined in your `.env` file.
| Variable | Used By | Description |
| -------------------------------------------- | ----------------------- | -------------------------------------------------------------- |
| `SFCC_MRT_PROJECT` | `push`, `create-bundle` | Project slug for Managed Runtime. |
| `SFCC_MRT_ENVIRONMENT` | `push` | Deployment target environment. |
| `SFCC_MRT_API_KEY` | `push` | API key for MRT authentication. |
| `SFCC_PROJECT_DIRECTORY` | All commands | Project directory (alternative to `--project-directory` flag). |
| `MRT_PROJECT` | `push`, `create-bundle` | Legacy alias for `SFCC_MRT_PROJECT`. |
| `MRT_TARGET` | `push` | Legacy alias for `SFCC_MRT_ENVIRONMENT`. |
| `PUBLIC__app__commerce__api__shortCode` | `dev`, `preview` | B2C Commerce API short code. |
| `PUBLIC__app__commerce__api__organizationId` | `dev`, `preview` | B2C Commerce organization ID. |
| `PUBLIC__app__commerce__api__clientId` | `dev`, `preview` | B2C Commerce client ID. |
| `PUBLIC__app__commerce__api__siteId` | `dev`, `preview` | B2C Commerce site ID. |
## See Also
- [Build Tools](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-build-tools.md) — Vite configuration and build system details.
- [Project Configuration](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-project-config.md) — Environment variables and storefront configuration.
- [B2C CLI: Storefront Next](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/storefront-next.html#storefront-next) — Create SLAS clients and Managed Runtime resources.
# Commerce Apps Overview
A Commerce App is a packaged, installable solution that bundles frontend UI components, backend server-side code, admin configuration, and platform data into a single deployable unit called a Commerce App Package (CAP). Commerce Apps represent the evolution of the Commerce Cloud cartridge model into a marketplace-ready packaging format designed for plug-and-play installation.
This guide is for two audiences who share the same CAP format and install job:
- **ISVs** publish to the [Commerce App Registry](https://github.com/SalesforceCommerceCloud/commerce-apps). Merchants discover those apps in Business Manager and click to install.
- **SIs** build merchant-specific **private** apps. They install from WebDAV (`AppSource=WebDAV`, feature type `CUSTOM_APP`) and don't appear in the Cart & Checkout Hub catalog. See [Develop a Private Commerce App](/docs/commerce/b2c-commerce/guide/private-commerce-apps.md).
For merchants, public Commerce Apps are discoverable in Business Manager. For ISV and SI developers, Commerce Apps can be managed through pro-code CLI solutions with automated local-to-cloud deployments and CI/CD integration. Both paths converge on the same platform framework.
The framework automates the orchestration of back-end extensions (cartridges, hooks) and frontend UI components for Storefront Next, significantly reducing implementation costs and time-to-value across the entire development lifecycle.

## What Can a Commerce App Contain?
A Commerce App can include any combination of the following:
- **Storefront Next extensions:** React components, React hooks, routes, and data providers that render in UI target locations across the storefront (PDP, PLP, Cart, Checkout, My Account, and so on).
- **Backend cartridges:** Server-side scripts, controllers, and hooks that implement business logic. These include both site cartridges (storefront logic) and BM cartridges (admin functionality).
- **Domain-specific hook implementations:** Script API implementations that fulfill platform-defined extension point contracts (for example, `sfcc.app.tax.calculate`).
- **Custom SCAPIs:** Custom API endpoints for headless/API-driven backend functionality.
- **IMPEX data:** Site-scoped XML for services, jobs, site preferences, custom object definitions, and metadata. Includes both install and uninstall payloads.
- **App configuration:** A `tasksList.json` file that defines the post-install configuration wizard steps a merchant must complete to activate the app.
- **App manifest:** A `commerce-app.json` file that defines the app's identity, version, domain, and publisher information. See [commerce-app.json Schema](/docs/commerce/b2c-commerce/guide/reference.md#commerce-appjson-schema).
Depending on what you build, your app follows one of three architectures: **UI-only** (frontend extensions only), **Backend-only** (extension point hook implementations only), or **Fullstack** (both frontend and backend, with two sub-types: extension points or custom SCAPI). See [The Three Architectures for Commerce Apps](/docs/commerce/b2c-commerce/guide/architecture.md#the-three-architectures-for-commerce-apps) for details.
## How Commerce Apps Differ from Cartridges
Commerce Cloud developers are familiar with cartridges as the primary unit of extensibility. Commerce Apps build on cartridges but add significant new capabilities:
- **Automated installation:** No more manual cartridge uploads, path editing, or IMPEX imports. The platform handles all of this through a single install job.
- **Frontend orchestration:** If your Commerce App includes Storefront Next components, installation can create a pull request that adds them to the merchant's storefront repository. The UI Targets framework then renders these components in the appropriate locations.
- **Domain isolation:** Commerce Apps introduce domain-specific extension points (for example, `sfcc.app.tax.calculate` instead of the shared `dw.order.calculateTax`) that eliminate code conflicts between integrations.
- **State tracking:** The platform tracks installation status, configuration progress, and activation state per-site through the CommerceFeatureState system.
- **Optional registry distribution:** ISVs can publish apps to the centralized [Commerce App Registry](https://github.com/SalesforceCommerceCloud/commerce-apps) for discovery and installation. Private apps use WebDAV instead.
## Quick Start with Claude Code
Use Claude Code's `/scaffold-app` skill to scaffold a new Commerce App in seconds. The skill generates a complete app directory structure with templates for `commerce-app.json`, `tasksList.json`, and starter IMPEX files. Additional skills for IMPEX generation (`/generate-service-impex`, `/generate-site-preferences-impex`), validation (`/validate-app`), and packaging (`/package-app`) are also available. See [Development Environment Setup](/docs/commerce/b2c-commerce/guide/development-environment.md#claude-code-skills) for the full list.
## Commerce App Development Lifecycle
Building a Commerce App follows this lifecycle:
1. [Understand the architecture](/docs/commerce/b2c-commerce/guide/architecture.md): domains, extension points, UI targets, and the three architectures.
2. [Set up your development environment](/docs/commerce/b2c-commerce/guide/development-environment.md) and sandbox.
3. [Build your app](/docs/commerce/b2c-commerce/guide/building-your-app.md): implement extension points, build UI extensions, create IMPEX data.
4. [Package your app](/docs/commerce/b2c-commerce/guide/packaging.md) into a Commerce App Package (CAP) following the required structure.
5. [Test and validate](/docs/commerce/b2c-commerce/guide/testing-validation.md) on a sandbox. ISVs also use the [review checklist](/docs/commerce/b2c-commerce/guide/testing-validation.md#review-checklist) before registry submission.
6. **Distribute:**
- **ISVs:** [Publish to the App Registry](/docs/commerce/b2c-commerce/guide/submission-review.md) for review and BM discoverability.
- **SIs:** [Install privately](/docs/commerce/b2c-commerce/guide/private-commerce-apps.md) with `b2c cap install` (WebDAV). Do not open a registry PR.
7. [Maintain](/docs/commerce/b2c-commerce/guide/post-publication.md) the installed app (replication, multi-site, monitoring). Registry versioning applies to ISVs only.
# Commerce Community Suite
The Commerce Community Suite is a selection of tools and libraries that you can use in your projects. We’ve chosen the tools based on their popularity and interoperability.
Unless you’re using another build tool, we also recommend using the Build Suite to deploy to environments in the primary instance group (staging, for example). As a best practice, don’t deploy to production systems by connecting your local workspace.
**tip:** Only existing customers can access some of the following links. Visit [Access the GitHub Repositories](https://trailhead.salesforce.com/content/learn/modules/b2c-developer-resources-and-tools/b2c-developer-access-repositories) for information about how to get access to the Community Suite repositories.
## Product Tools
[Storefront Reference Architecture](https://github.com/SalesforceCommerceCloud/storefront-reference-architecture)
Check out this repository for the Storefront Reference Architecture (SFRA) reference application.
## SOM-SFRA Self-Service Plugin
[SOM-SFRA Self-Service Plugin](https://github.com/SalesforceCommerceCloud/plugin_ordermanagement)
Check out this repository for the Salesforce Order Management - SFRA Self-Service Plugin. This plugin enhances the `app_storefront_base` cartridge by providing "Salesforce Order Management self-service" functionality.
## Community Suite
[Page Designer Reference Implementation](https://github.com/SalesforceCommerceCloud/page-designer-reference)
This resource contains example page types and component types for Salesforce B2C Commerce Page Designer. Use these examples as a starting point for developing your own custom page types and component types.
[SFRA Themes Plugin](https://github.com/SalesforceCommerceCloud/plugin_themes)
This plugin enhances the Storefront Reference Architecture (SFRA) by providing theming capabilities using Page Designer. Modify the look and feel of your website with clicks not code!
[Instance Initializer](https://github.com/SalesforceCommerceCloud/instance-initializer)
Create and initialize a sandbox by deploying code and data, and bootstrapping the instance (that is, building the search index, installing plugins, and so on). Use this tool to quickly spin up a [Storefront Reference Architecture](https://github.com/SalesforceCommerceCloud/storefront-reference-architecture) Demo Box. This tool also provides examples on how to use [sfcc-ci](https://github.com/SalesforceCommerceCloud/sfcc-ci).
[SFRA Service Worker Plugin](https://github.com/SalesforceCommerceCloud/plugin_serviceworker)
This service worker plugin for Storefront Reference Architecture (SFRA) includes basic Progressive Web Apps (PWA) features and advanced caching capabilities.
[Style Guide](https://github.com/SalesforceCommerceCloud/styleguide)
The coding style guide applies a defined set of standards to the development process. It includes ESLint configuration files so that you can automate code checks.
[SFRA Webpack Builder](https://github.com/SalesforceCommerceCloud/sfra-webpack-builder)
Because webpack can be cumbersome to set up, especially in multicartridge projects for SFRA, use this plugin to bundle all your .js, .scss, and .jsx files out of the box.
[Unit Testing / DW API Mock](https://github.com/SalesforceCommerceCloud/dw-api-mock/)
The API mock provides the B2C Commerce API as stubs and instructions on how to use this stub with Mocha JS to create and run unit tests for B2C Commerce scripts. The tests run in a Node.js environment and can be embedded into build scripts or BitBucket pipelines.
[Build Suite](https://github.com/SalesforceCommerceCloud/build-suite)
The Build Suite is a popular and well-tested JavaScript tool powered by Grunt. Use a set of scripts to automate your build processes and add additional value. The Build Suite offers numerous features such as Linting (server-side DS files), resource optimization, Storefront Toolkit Build information, test files, and two-factor authentication (2FA).
[B2C Commerce CI](https://github.com/SalesforceCommerceCloud/sfcc-ci)
The Salesforce B2C Commerce CI is a command-line interface (CLI) for interacting with B2C Commerce instances from the command line or shell of various operating systems to facilitate Continuous Integration practices. It provides a JavaScript API that you can use to integrate with higher-level build tools, such as the Build Suite.
[Custom Feeds](https://github.com/SalesforceCommerceCloud/custom-feeds)
Use Custom Feeds to define extra export feeds in XML or CSV format. Check out the detailed instructions. Provide catalog feeds to marketing providers, such as Google Shopping or ad agencies.
[Simple Ratings & Reviews](https://github.com/SalesforceCommerceCloud/simple-r-r)
Simple Ratings & Reviews uses custom objects to let customers submit reviews, and aggregates the numbers later (number of reviews, average, and so on).
**note:** This feature is intended for small and medium-size clients, with a limit of one million product reviews total.
[Business Manager Tools](https://github.com/SalesforceCommerceCloud/bm-tools)
This solution provides the following tools for Business Manager:
- Total File Demander: Access a remote server from this instance to circumvent firewall issues.
- Browse Remote - HTTP(s): Access remote HTTP(s) URLs from this instance to check if a connection between the systems can be established, to circumvent firewall issues and to check the responses a request produces.
[Catalog Reducer](https://github.com/SalesforceCommerceCloud/catalog-reducer)
Use this node tool to reduce the size of a large catalog by using selection criteria. For example, you can reduce a catalog with 100,000 products to a catalog with 1,000 products by having a minimum number of main products, or products with certain attributes set.
[He-Com](https://github.com/SalesforceCommerceCloud/he-com)
This sample implementation shows Headless ecommerce running on, for example, Heroku.
[Job Components](https://github.com/SalesforceCommerceCloud/job-components)
This toolbox is for basic operations done in jobs. It’s a successor for the deprecated Integration Framework’s Standard Components.
## Tooling/IDEs
[Visual Studio Code - Prophet Debugger](https://marketplace.visualstudio.com/items?itemName=SqrTT.prophet)
This extension enables code upload and debugging.
[Digital API Language Definitions in Typescript Format](https://github.com/SalesforceCommerceCloud/dw-api-types)
Use these type definitions for code completion in WebStorm or VS Code.
## Deprecated Tools
[Service Framework / package.dw.svc](https://github.com/SalesforceCommerceCloud/service-framework)
The Service Framework wraps web services into script classes and provides configuration for synchronous services (SOAP, HTTP, and FTP).
[Active Recommendations](https://github.com/SalesforceCommerceCloud/active_recommendations)
Use Active Recommendations to implement a simple upselling feature. This solution uses live order analysis and customer active data to create a product recommendation section to show shoppers during checkout as an upsell incentive.
[Content Copy Tool](https://github.com/SalesforceCommerceCloud/content-copy-tool)
Use this custom Business Manager module to transfer files between different server locations and the local file system, similar to an FTP client. Upload files, manipulate folders, and copy Content Assets or Content Slots, making your merchandising work so much easier.
[Data Resource Usage](https://github.com/SalesforceCommerceCloud/dataresourceusage)
Data Resource Usage gives access to the environment via WebDAV and calculates the aggregated size of directories.
[Dynamic Imaging Service (DIS) Wrapper](https://github.com/SalesforceCommerceCloud/dis-product-image-wrapper)
The Dynamic Imaging Service (DIS) Wrapper is helpful when you need multiple product image sizes but don’t have the backend system or processes to scale and replicate all the data to B2C Commerce sandboxes. Upload one image size, and any additional sizes that you need for your website are derived from the uploaded image.
[Agentforce Marketing Connector](https://github.com/SalesforceCommerceCloud/marketing-cloud-connector)
The Agentforce Marketing Connector includes reusable code (written in B2C Commerce JavaScript) and implementation best practices to accelerate integration between B2C Commerce and Agentforce Marketing. Supported use cases include sending transactional emails and behavioral emails, such as for abandoned cart, abandoned browse, and abandoned search.
[Agentforce Service Connector](https://github.com/SalesforceCommerceCloud/service-cloud-connector)
The Salesforce B2C Commerce to Agentforce Service Connector is a Salesforce Labs project that facilitates the integration between Salesforce B2C Commerce and Agentforce Service. This connector provides a framework for integrating these two products, leveraging public REST APIs to share and synchronize data.
Commerce Delivery Service
# Commerce Delivery Service
## API Overview
The Commerce Delivery Service API provides estimation endpoints plus provisioning, routing, and health endpoints. It also predicts the estimated delivery date for one or more items on the storefront (from a product detail page (PDP) or checkout), reflecting the fulfillment location if an order is placed.
This specification includes both v1 and v2 API endpoints. Use version-prefixed paths (/v1/\* or /v2/\*) to access the respective API versions.
### Authentication & Authorization
For resource access, you must use a client ID and client secret from Account Manager to request an access token. The access token is used as a bearer token and added to the Authorization header of your API request.
The API client must also have the `sfcc.commercedeliveryservice.shopper` OAuth scope. You must include the relevant scope in the client ID used to generate the token. For a full list of required permissions, see the [Authorization Scopes Catalog](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html).
For detailed setup instructions, see [Authorization for Admin APIs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-admin-apis.html).
### Use Cases
#### Estimate Delivery Date
Use the delivery-date endpoint to provide an estimated delivery date or delivery date range when
* A shopper is on a PDP and wants to know the estimated delivery date for a product before adding it to their cart, or
* A shopper is checking out and wants to know the estimated delivery date for the products being purchased.
#### Estimate Delivery Date by Location
Use the delivery-date-by-locations endpoint to provide an estimated delivery date or delivery date range based on a specific location group level when
* A shopper is on a PDP and wants to know the estimated delivery date for a product based on a specific location before adding it to their cart, or
* A shopper is checking out and wants to know the estimated delivery date for the products being purchased based on a specific location.
#### Estimate Buy Online, Pick Up In Store (BOPIS) Time
Use the BOPIS endpoint to provide an estimated earliest pickup time for BOPIS orders when
* A shopper is on a Product Detail Page (PDP) and wants to know when a product will be ready for pickup at specific store locations before adding it to their cart.
* A shopper wants to find nearby stores within a specified radius where a product is available for pickup, sorted by distance, along with the earliest pickup time at each location. This use case supports "find stores near me" scenarios where you provide an address, radius distance, unit (miles/km), and an optional maximum number of locations to return, sorted by distance with pickup times.
* A shopper is checking out with a BOPIS delivery method and wants to know the earliest pickup time and available inventory for the products being purchased at nearby store locations.
**Version:** v1
## Servers
* `https://api.salesforce.com/commerce/delivery`
Default security: bearerAuth.
## Security
* `bearerAuth` (http) Bearer token (e.g. OAuth access token)
* HTTP scheme: bearer (JWT)
## Operations
### PUT Provisions a core Org as a commerce delivery service (CDS) tenant in the service
`PUT /v1/organization/{orgId}`
Operation ID: `organization/provision`. Tags: Provisioning.
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `orgId` (path, string, required) A valid 18 char core OrgId
#### Request body (required)
Media type: `application/json`. Schema: `ProvisionCDSTenantRequest`.
#### Responses
* **200** An existing CDS tenant record is updated with the specified values
* **201** A new CDS tenant record is created with the specified values
* **500** An internal server error when processing the request
### DELETE Deprovisions a CDS tenant
`DELETE /v1/organization/{orgId}`
Operation ID: `organization/deprovision`. Tags: De-Provisioning.
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `orgId` (path, string, required) A valid 18 char core OrgId
#### Responses
* **200** CDS tenant successfully deprovisioned
* **404** Specified CDS tenant (OrgId) does not exist
* **500** An internal server error when processing the request
### PUT Provisions the given B2CE Tenant for a the specified core org
`PUT /v1/organization/{orgId}/b2ce-tenant/{b2ceTenantId}`
Operation ID: `organization/b2ce-tenant/provision`. Tags: Provisioning.
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `orgId` (path, string, required) A valid 18 char core OrgId
* `b2ceTenantId` (path, string, required) B2CE realm and instance separated by underscore (\_)
#### Request body (required)
Media type: `application/json`. Schema: `ProvisionB2CETenantRequest`.
#### Responses
* **200** An existing B2CE tenant record is updated with the specified values
* **201** A new B2CE tenant record is created with the specified values
* **404** Specified CDS tenant (OrgId) does not exist
* **500** An internal server error when processing the request
### DELETE Deprovisions a B2CE tenant
`DELETE /v1/organization/{orgId}/b2ce-tenant/{b2ceTenantId}`
Operation ID: `organization/b2ce-tenant/deprovision`. Tags: De-Provisioning.
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `orgId` (path, string, required) A valid 18 char core OrgId
* `b2ceTenantId` (path, string, required) B2CE realm and instance separated by underscore (\_)
#### Responses
* **200** B2CE tenant successfully deprovisioned
* **404** Specified B2CE tenant does not exist
* **500** An internal server error when processing the request
### PUT Creates or Updates the delivery estimation configuration for the given CDS tenant
`PUT /v1/organization/{orgId}/configuration/{externalReference}`
Operation ID: `organization/configuration`. Tags: Provisioning.
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `orgId` (path, string, required) A valid 18 char core OrgId
* `externalReference` (path, string, required) Name of the WebStore or SalesChannel
#### Request body (required)
Media type: `application/json`. Schema: `CommerceDeliveryServiceSetupRequest`.
#### Responses
* **200** An existing delivery estimation config record is updated with the specified values for a given CDS tenant
* **201** A new delivery estimation config record is created with the specified values for a given CDS tenant
* **404** Specified CDS tenant (OrgId) does not exist
* **500** An internal server error when processing the request
### PUT Creates or updates the location graph for an organization
`PUT /v1/organization/{orgId}/locationgraph`
Operation ID: `organization/locationgraph/upsert`. Tags: Location Graph.
Upserts location graph data including locations and location groups for delivery estimation routing
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) The ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `orgId` (path, string, required) A valid 18 char core OrgId
#### Request body (required)
Media type: `application/json`. Schema: `LocationGraphRequest`.
#### Responses
* **200** An existing location graph is updated
Media type: `application/json`. Schema: `ApiResponse`.
* **201** A new location graph is created
Media type: `application/json`. Schema: `ApiResponse`.
* **400** Bad request - validation failed or tenant not found
Media type: `application/json`. Schema: `ApiResponse`.
* **500** Internal server error
Media type: `application/json`. Schema: `ApiResponse`.
### PUT Performs delta synchronization of entities for a CDS tenant
`PUT /v1/organization/{orgId}/{entityType}`
Operation ID: `deltaSyncEntities`. Tags: Delta Sync.
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `ContinueOnError` (header, boolean) Whether to continue processing on errors
Default: `true`.
* `orgId` (path, string, required) A valid 18 char core OrgId
* `entityType` (path, string, required) Type of entity to sync (e.g., Location, LocationGroup)
#### Request body (required)
Media type: `application/json`. Schema: `array of DeltaSyncItemRequest`.
Array of `DeltaSyncItemRequest`.
#### Responses
* **200** Delta sync completed
Media type: `application/json`. Schema: `DeltaSyncResponse`.
* **400** Bad request - validation failed
Media type: `application/json`. Schema: `DeltaSyncResponse`.
* **500** Internal server error
Media type: `application/json`. Schema: `DeltaSyncResponse`.
### PUT Creates or Updates the fulfilment routing criteria configuration for the given CDS tenant
`PUT /v1/organization/{orgId}/fulfillment-criteria-management/{externalReference}`
Operation ID: `organization/fulfillment-criteria-management-provision`. Tags: Provisioning.
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `orgId` (path, string, required) A valid 18 char core OrgId
* `externalReference` (path, string, required) Name of the WebStore or SalesChannel
#### Request body (required)
Media type: `application/json`. Schema: `FulfillmentCriteriaRequest`.
#### Responses
* **200** An existing fulfilment routing criteria record is updated with the specified values for a given CDS tenant
Media type: `application/json`. Schema: `ApiResponse`.
* **201** A new fulfilment routing criteria record is created with the specified values for a given CDS tenant
Media type: `application/json`. Schema: `ApiResponse`.
* **404** Specified CDS tenant (OrgId) does not exist
* **500** An internal server error when processing the request
### DELETE Delete the fulfilment routing criteria configuration for the given CDS tenant
`DELETE /v1/organization/{orgId}/fulfillment-criteria-management/{externalReference}`
Operation ID: `organization/fulfillment-criteria-management-deprovision`. Tags: De-Provisioning.
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
* `orgId` (path, string, required) A valid 18 char core OrgId
* `externalReference` (path, string, required) Name of the WebStore or SalesChannel
#### Responses
* **200** A fulfilment routing criteria record is deleted with the specified values for a given CDS tenant
Media type: `application/json`. Schema: `ApiResponse`.
* **404** Specified CDS tenant (OrgId) does not exist
* **500** An internal server error when processing the request
### POST Calculates the EstimatedShipDate and EstimatedDeliveryDate based on default store level settings
`POST /v1/estimate/delivery-date`
Operation ID: `estimate/delivery-date`. Tags: DeliveryEstimation.
Get Estimation Delivery Date API based on the "LocationGroup" level (default) settings
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
#### Request body (required)
Media type: `application/json`. Schema: `GetDeliveryEstimationDateRequest`.
#### Responses
* **200** Returns the EstimatedShipDate and EstimatedDeliveryDate based on the default settings
Media type: `application/json`. Schema: `GetDeliveryEstimationDateResponse`.
* **400** Returns the GetDeliveryEstimationDateResponse with error code and error message
Media type: `application/json`. Schema: `GetDeliveryEstimationDateResponse`.
* **500** An internal server error when processing the request
### POST Calculates the EstimatedShipDate and EstimatedDeliveryDate based on location level settings
`POST /v1/estimate/delivery-date-by-locations`
Operation ID: `estimate/delivery-date-by-locations`. Tags: DeliveryEstimation.
Get Estimation Delivery Date API based on the "Location" level (override) settings, if the overrides is not configured use the default configuration values
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
#### Request body (required)
Media type: `application/json`. Schema: `GetDeliveryEstimationDateRequest`.
#### Responses
* **200** Returns the EstimatedShipDate and EstimatedDeliveryDate based on the overrides settings if exist, otherwise based on default configuration values
Media type: `application/json`. Schema: `GetDeliveryEstimationDateResponse`.
* **400** Returns the GetDeliveryEstimationDateResponse with error code and error message
Media type: `application/json`. Schema: `GetDeliveryEstimationDateResponse`.
* **500** An internal server error when processing the request
### POST Calculates the earliest pickup time for locations that accept BOPIS orders
`POST /v1/estimate/bopis`
Operation ID: `estimate/bopis`. Tags: DeliveryEstimation.
Get Estimation Delivery Date API for Bopis orders
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
#### Request body (required)
Media type: `application/json`. Schema: `BopisEstimationRequest`.
#### Responses
* **200** Returns the earliest pickup time for a products with inventory data.
Media type: `application/json`. Schema: `BopisEstimationResponse`.
* **400** Returns the BopisEstimationResponse with errors
Media type: `application/json`. Schema: `BopisEstimationResponse`.
* **500** An internal server error when processing the request
### POST Returns the best routing route for the given skus
`POST /v1/route/routing-rules`
Operation ID: `route/routing-rules`. Tags: DeliveryRoutingEngine.
Executes the routing fulfilment routing criteria and return the best routing route for the given request
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
#### Request body (required)
Media type: `application/json`. Schema: `RoutingRulesExecutionRequest`.
#### Responses
* **200** Returns the best route for delivery/estimation.
Media type: `application/json`. Schema: `RoutingRulesExecutionResponse`.
* **400** Returns the RoutingRulesExecutionResponse with errors
Media type: `application/json`. Schema: `RoutingRulesExecutionResponse`.
* **500** An internal server error when processing the request
### GET Checks the status of the DB and authorization service.
`GET /v1/health`
Operation ID: `getHealth`. Tags: Application.
Gets the health of the application.
#### Responses
* **200** Return the health of the db and authorization Service.
Media type: `application/json`. Schema: `HealthResponse`.
* **500** Returns error message when we can't determine the health of the application and status of Down.
Media type: `application/json`. Schema: `HealthResponse`.
### POST Calculates the EstimatedShipDate and EstimatedDeliveryDate based on default store level settings
`POST /v2/estimate/delivery-date`
Operation ID: `estimate/delivery-date-v2`. Tags: DeliveryEstimation.
Get Estimation Delivery Date API based on the "LocationGroup" level (default) settings
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
#### Request body (required)
Media type: `application/json`. Schema: `GetDeliveryEstimationDateRequest`.
#### Responses
* **200** Returns the EstimatedShipDate and EstimatedDeliveryDate based on the default settings
Media type: `application/json`. Schema: `DeliveryEstimationResponse`.
* **400** Returns the DeliveryEstimationResponse with error code and error message
Media type: `application/json`. Schema: `DeliveryEstimationResponse`.
* **500** An internal server error when processing the request
### POST Calculates the EstimatedShipDate and EstimatedDeliveryDate based on location level settings
`POST /v2/estimate/delivery-date-by-locations`
Operation ID: `estimate/delivery-date-by-locations-v2`. Tags: DeliveryEstimation.
Get Estimation Delivery Date API based on the "Location" level (override) settings, if the overrides is not configured use the default configuration values
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
#### Request body (required)
Media type: `application/json`. Schema: `GetDeliveryEstimationDateRequest`.
#### Responses
* **200** Returns the EstimatedShipDate and EstimatedDeliveryDate based on the overrides settings if exist, otherwise based on default configuration values
Media type: `application/json`. Schema: `DeliveryEstimationResponse`.
* **400** Returns the DeliveryEstimationResponse by location with error code and error message
Media type: `application/json`. Schema: `DeliveryEstimationResponse`.
* **500** An internal server error when processing the request
### POST Calculates the earliest pickup time for locations that accept BOPIS orders
`POST /v2/estimate/bopis`
Operation ID: `estimate/bopis-v2`. Tags: DeliveryEstimation.
Get Estimation Delivery Date API for Bopis orders
#### Parameters
* `Authorization` (header, string, required) Token Authorization
* `Correlation-ID` (header, string, required) the ID used to correlate requests
* `x-salesforce-region` (header, string, required) The service's targeted deployment region
#### Request body (required)
Media type: `application/json`. Schema: `BopisEstimationRequest`.
#### Responses
* **200** Returns the earliest pickup time for a products with inventory data.
Media type: `application/json`. Schema: `BopisEstimationResponse`.
* **400** Returns the BopisEstimationResponse with errors
Media type: `application/json`. Schema: `BopisEstimationResponse`.
* **500** An internal server error when processing the request
## Schemas
### ProvisionCDSTenantRequest
* `CoreC2CEnvironment` (_string_, required)
* `CoreUrl` (_string_, required)
* `UserId` (_string_, required)
* `EinsteinFalconInstance` (_string_)
* `InventoryShortCode` (_string_)
* `TenantGroupUUID` (_string_, required)
### ProvisionB2CETenantRequest
* `Url` (_string_, required)
* `UserId` (_string_, required)
### CommerceDeliveryServiceSetupRequest
* `DeliveryEstimationSetup` (_object_, required)
* `Name` (_string_, required)
* `Id` (_string_, required)
* `UserId` (_string_, required)
* `RoutingCalcType` (_string_, required)
* `FulfillmentTimeCalcType` (_string_, required)
* `TransitTimeCalcType` (_string_, required)
* `LocationGroupName` (_string_, required)
* `RoutingAIApplicationId` (_string_)
* `IsDefault` (_boolean_, required)
* `IsEnabled` (_boolean_, required)
* `ProcessingTime` (_integer_, required)
* `ProcessingTimeUnit` (_string_, required)
* `PickUpTime` (_string_, required)
* `TimeZoneSid` (_integer_, required)
* `BusinessHours` (_BusinessHours_, required)
* `ShippingCarrierMethods` (_array of ShippingCarrierMethod_, required)
* `locations` (_array of Location_)
### LocationGraphRequest
* `UserId` (_string_, required) The user ID performing the operation
* `Locations` (_array of Location_, required) List of locations in the graph
* `Groups` (_array of Group_, required) List of location groups
### ApiResponse
* `isSuccess` (_boolean_, required)
* `error` (_array of Error_)
### DeltaSyncItemRequest
* `key` (_object_, required) Unique identifier for the entity being synced
* `standardFields` (_object_) Standard fields for the entity
* `customFields` (_array of CustomFieldRequest_) Custom fields for the entity
### DeltaSyncResponse
* `totalCount` (_integer_) Total number of entities in the sync request
* `successCount` (_integer_) Number of entities successfully synced
* `failedCount` (_integer_) Number of entities that failed to sync
* `results` (_array of DeltaSyncItemResult_) Detailed results for each entity
* `success` (_boolean_) Overall success status of the sync operation
### FulfillmentCriteriaRequest
* `id` (_string_, required)
* `name` (_string_, required)
* `usageType` (_string_, required)
* `description` (_string_)
* `isActive` (_boolean_, required)
* `pubFulfmtRoutgCritGrpVer` (_string_)
* `draftFulfmtRoutgCritGrpVer` (_string_)
* `externalReference` (_string_, required)
* `fulfmtRoutgCriteriaGrpVer` (_FulfmtRoutgCriteriaGrpVer_, required)
### GetDeliveryEstimationDateRequest
* `deliveryEstimationSetupName` (_string_, required)
* `shippingCarrier` (_object_, required)
* `name` (_string_)
* `methods` (_array of object_, required)
* `name` (_string_, required)
* `locations` (_array of string_)
* `products` (_array of object_, required)
* `stockKeepingUnit` (_string_, required)
* `quantity` (_integer_, required)
Minimum: 1.
* `deliveryAddress` (_object_, required)
* `country` (_string_, required)
* `state` (_string_, required)
* `city` (_string_, required)
* `postalCode` (_string_, required)
* `latitude` (_number_)
* `longitude` (_number_)
### GetDeliveryEstimationDateResponse
* `estimatedDeliveryReference` (_string_, required)
* `deliveryEstimates` (_array of object_, required)
* `shippingCarrierMethod` (_string_, required)
* `ProductDeliveryEstimations` (_array of ProductDeliveryEstimations_)
* `error` (_object_)
* `code` (_string_, required)
dictionary:
* B2CE\_TENANT\_NOT\_FOUND The B2CE Tenant is not configured for delivery estimation
* SHIPPING\_CARRIER\_METHOD\_NOT\_FOUND The ShippingCarrierMethod is not configured for DeliveryEstimation
* DELIVERY\_ESTIMATION\_TENANT\_NOT\_FOUND The Commerce Delivery Service Tenant is not configured for DeliveryEstimation
* CHANNEL\_NOT\_SUPPORTED The channel is not configured for DeliveryEstimation
* INTERNAL\_SERVER\_ERROR Unexpected error occurred when processing the request
Allowed values: `B2CE_TENANT_NOT_FOUND`, `SHIPPING_CARRIER_METHOD_NOT_FOUND`, `DELIVERY_ESTIMATION_TENANT_NOT_FOUND`, `CHANNEL_NOT_SUPPORTED`, `INTERNAL_SERVER_ERROR`.
* `message` (_string_, required)
### BopisEstimationRequest
* `deliveryEstimationSetupName` (_string_, required)
* `products` (_array of Product_, required)
* `locations` (_array of string_)
* `address` (_CustomerAddress_)
* `radius` (_number (double)_)
* `unit` (_string_)
* `maxReturnedLocations` (_integer (int32)_)
### BopisEstimationResponse
* `error` (_array of object_)
* `code` (_string_, required)
* `message` (_string_, required)
* `results` (_array of object_)
* `stockKeepingUnit` (_string_, required)
* `location` (_string_, required)
* `inventory` (_object_, required)
* `onHand` (_integer_, required)
* `availableToOrder` (_integer_, required)
* `availableToFulfill` (_integer_, required)
* `distance` (_number_, required)
* `unit` (_string_, required) Unit of distance measurement
* `inStore` (_object_, required) In-store pickup information
* `earliestPickupTime` (_string_, required)
### RoutingRulesExecutionRequest
* `tenantId` (_string_, required)
* `fullfilmentCriteriaGroupName` (_string_, required)
* `products` (_array of Product_, required)
* `locationGroupName` (_string_, required)
* `deliveryAddress` (_DeliveryAddress_, required)
* `excludeLocations` (_array of string_)
### RoutingRulesExecutionResponse
* `routes` (_array of Route_)
* `bestLocationsPerSKU` (_object_)
Additional properties: `array of LocationInfo`.
* `errors` (_array of Error_)
* `success` (_boolean_)
### HealthResponse
* `status` (_string_, required)
* `details` (_object_)
* `auth` (_string_)
* `db` (_string_)
* `Error` (_string_)
### DeliveryEstimationResponse
* `estimatedDeliveryReference` (_string_, required)
* `deliveryEstimates` (_array of object_, required)
* `deliveryGroupId` (_integer_, required)
* `deliveryEstimateGroup` (_array of DeliveryEstimateGroup_, required)
### BusinessHours
* `Id` (_string_)
* `MondayStartTime` (_string_)
* `MondayEndTime` (_string_)
* `TuesdayStartTime` (_string_)
* `TuesdayEndTime` (_string_)
* `WednesdayStartTime` (_string_)
* `WednesdayEndTime` (_string_)
* `ThursdayStartTime` (_string_)
* `ThursdayEndTime` (_string_)
* `FridayStartTime` (_string_)
* `FridayEndTime` (_string_)
* `SaturdayStartTime` (_string_)
* `SaturdayEndTime` (_string_)
* `SundayStartTime` (_string_)
* `SundayEndTime` (_string_)
### ShippingCarrierMethod
* `Name` (_string_, required)
* `Id` (_string_, required)
* `CarrierName` (_string_, required)
* `MinTransitTime` (_integer_)
* `MaxTransitTime` (_integer_)
* `TransitTimeUnit` (_string_)
* `ShippingAreaType` (_string_, required)
### Location
* `name` (_string_, required)
* `id` (_string_, required)
* `processingTime` (_integer_)
* `processingTimeUnit` (_string_)
* `pickUpTime` (_string_)
* `timeZoneSid` (_integer_)
* `isEnabled` (_boolean_, required)
* `address` (_Address_)
* `businessHours` (_BusinessHours_)
* `shippingCarrierMethods` (_array of ShippingCarrierMethod_)
* `HasProductsInMarkdown` (_boolean_) Whether location has markdown products
* `IsEligibleForPickup` (_boolean_) Whether location supports pickup
* `EarliestPickupTimeOffset` (_integer_) Earliest pickup time offset in minutes
* `LatestPickupTimeOffset` (_integer_) Latest pickup time offset in minutes
* `PickupProcessingTime` (_integer_) Processing time for pickup orders
* `PickupProcessingTimeUnit` (_string_) Unit of time for pickup processing
Allowed values: `Minutes`, `Hours`, `Days`, `Weeks`.
* `ShouldTrackFoCapacity` (_boolean_) Whether to track fulfillment order capacity
* `AssignedFoCount` (_integer_) Number of assigned fulfillment orders
* `FoCapacity` (_integer_) Fulfillment order capacity
* `Priority` (_string_) Location priority (DynamicEnum)
* `CustomFields` (_array of CustomField_)
### Group
* `Id` (_string_, required) Unique identifier for the location group
* `Name` (_string_, required) Name of the location group
* `Locations` (_array of string_, required) List of location IDs belonging to this group
### Error
* `code` (_string_, required)
Allowed values: `B2CE_TENANT_NOT_FOUND`, `INVALID_C2C_ISSUING_CLOUD`, `INTERNAL_SERVER_ERROR`, `ROUTING_ROUTES_EVALUATION_LIMIT_EXCEEDED`, `INVALID_REQUEST`, `RULE_GROUP_NOT_FOUND`, `INSUFFICIENT_INVENTORY`, `INVENTORY_SERVICE_ERROR`, `INVENTORY_LOCATION_NOT_FOUND`, `INVENTORY_CALL_TIMEOUT`, `LOCATION_GROUP_NOT_FOUND`.
* `message` (_string_, required)
### CustomFieldRequest
* `FieldName` (_string_, required) Name of the custom field
* `FieldType` (_string_, required) Data type of the custom field
* `FieldValue` (_any_) Value of the custom field (any type)
### DeltaSyncItemResult
* `key` (_object_) The key of the synced entity
* `status` (_string_) Status of the sync operation for this entity
Allowed values: `SUCCESS`, `FAILED`, `SKIPPED`.
* `errorCode` (_string_) Error code if the sync failed
* `errorMessage` (_string_) Error message if the sync failed
### FulfmtRoutgCriteriaGrpVer
* `id` (_string_, required)
* `name` (_string_, required)
* `description` (_string_)
* `fulfmtRoutgCriteriaGrp` (_string_, required)
* `versionNumber` (_string_, required)
* `refFulfmtRoutgCritGrpVer` (_string_)
* `state` (_string_, required)
* `maxSplitsAllowed` (_integer_)
* `byPassSplits` (_boolean_)
* `fulfmtRoutgCriteria` (_array of FulfmtRoutgCriteria_)
### ProductDeliveryEstimations
* `stockKeepingUnit` (_string_)
* `quantity` (_integer_)
Minimum: 1.
* `routingCalculationType` (_string_)
* `estimatedShipDate` (_EstimatedShipDate_)
* `estimatedDeliveryDate` (_EstimatedDeliveryDate_)
### Product
* `stockKeepingUnit` (_string_, required)
* `quantity` (_integer_, required)
Minimum: 1.
### CustomerAddress
* `countryCode` (_string_) ISO country code
* `postalCode` (_string_) Postal or ZIP code
* `latitude` (_number (double)_) Latitude coordinate
Minimum: -90. Maximum: 90.
* `longitude` (_number (double)_) Longitude coordinate
Minimum: -180. Maximum: 180.
### DeliveryAddress
* `country` (_string_, required)
* `state` (_string_)
* `city` (_string_)
* `postalCode` (_string_, required)
* `latitude` (_number (double)_)
* `longitude` (_number (double)_)
### Route
* `locations` (_array of LocationRoute_)
* `totalScore` (_number (double)_)
### LocationInfo
* `locationId` (_string_)
* `quantityAvailableToOrder` (_integer_)
* `unitScore` (_number (double)_)
### DeliveryEstimateGroup
* `location` (_string_, required)
* `productDeliveryEstimations` (_array of ProductDeliveryEstimationsV2_, required)
* `shippingMethods` (_array of object_, required)
* `shippingCarrierMethod` (_string_, required)
* `routingCalculationType` (_string_, required)
* `estimatedShipDate` (_DeliveryEstimate_, required)
* `estimatedDeliveryDate` (_DeliveryEstimate_)
* `error` (_object_)
* `code` (_string_, required)
dictionary:
* B2CE\_TENANT\_NOT\_FOUND The B2CE Tenant is not configured for delivery estimation
* SHIPPING\_CARRIER\_METHOD\_NOT\_FOUND The ShippingCarrierMethod is not configured for DeliveryEstimation
* DELIVERY\_ESTIMATION\_TENANT\_NOT\_FOUND The Commerce Delivery Service Tenant is not configured for DeliveryEstimation
* CHANNEL\_NOT\_SUPPORTED The channel is not configured for DeliveryEstimation
* INTERNAL\_SERVER\_ERROR Unexpected error occurred when processing the request
Allowed values: `B2CE_TENANT_NOT_FOUND`, `SHIPPING_CARRIER_METHOD_NOT_FOUND`, `DELIVERY_ESTIMATION_TENANT_NOT_FOUND`, `CHANNEL_NOT_SUPPORTED`, `INTERNAL_SERVER_ERROR`.
* `message` (_string_, required)
### Address
* `street1` (_string_)
* `street2` (_string_)
* `state` (_string_)
* `city` (_string_)
* `postalCode` (_string_, required)
* `country` (_string_)
* `latitude` (_number_)
* `longitude` (_number_)
### CustomField
* `FieldName` (_string_, required) Name of the custom field
* `FieldType` (_string_, required) Data type of the custom field
* `FieldValue` (_any_) Value of the custom field (any type)
### FulfmtRoutgCriteria
* `id` (_string_, required)
* `name` (_string_, required)
* `type` (_string_, required)
* `usageType` (_string_, required)
* `templateName` (_string_)
* `isActive` (_boolean_, required)
* `description` (_string_)
* `refFulfmtRoutgCriteria` (_string_)
* `fulfmtRoutgCriteriaGrpVer` (_string_, required)
* `conditionExpression` (_string_)
* `weight` (_number (double)_)
* `actionExpression` (_string_)
* `startDate` (_string (date-time)_)
* `endDate` (_string (date-time)_)
* `fulfmtRoutgCriteriaActnVar` (_array of FulfmtRoutgCriteriaActnVar_, required)
* `fulfmtRoutgCriteriaCond` (_array of FulfmtRoutgCriteriaCond_, required)
### EstimatedShipDate
* `type` (_string_, required)
* `min` (_string (date-time)_, required)
* `max` (_string (date-time)_, required)
### EstimatedDeliveryDate
* `type` (_string_, required)
* `min` (_string (date-time)_, required)
* `max` (_string (date-time)_, required)
### LocationRoute
* `location` (_string_)
* `products` (_array of ProductRoute_)
### ProductDeliveryEstimationsV2
* `stockKeepingUnit` (_string_)
* `quantity` (_integer_)
Minimum: 1.
### DeliveryEstimate
* `type` (_string_, required)
* `min` (_string (date-time)_, required)
* `max` (_string (date-time)_, required)
### FulfmtRoutgCriteriaActnVar
* `id` (_string_, required)
* `fulfmtRoutgCriteria` (_string_, required)
* `variableIdentifier` (_string_, required)
* `entity` (_string_, required)
* `field` (_string_)
### FulfmtRoutgCriteriaCond
* `id` (_string_, required)
* `fulfmtRoutgCriteria` (_string_, required)
* `identifier` (_integer_, required)
* `operator` (_string_, required)
* `leftEntity` (_string_, required)
* `leftField` (_string_, required)
* `rightEntity` (_string_)
* `rightField` (_string_)
* `rightValue` (_string_)
### ProductRoute
* `product` (_string_)
* `quantity` (_number_)
* `unitScore` (_number (double)_)
### GetDeliveryEstimationDateLocationResponse
* `estimatedDeliveryReference` (_string_, required)
* `deliveryEstimates` (_array of object_, required)
* `shippingCarrierMethod` (_string_, required)
* `location` (_string_)
* `ProductDeliveryEstimations` (_array of ProductDeliveryEstimations_)
* `error` (_object_)
* `code` (_string_, required)
dictionary:
* B2CE\_TENANT\_NOT\_FOUND The B2CE Tenant is not configured for delivery estimation
* SHIPPING\_CARRIER\_METHOD\_NOT\_FOUND The ShippingCarrierMethod is not configured for DeliveryEstimation
* DELIVERY\_ESTIMATION\_TENANT\_NOT\_FOUND The Commerce Delivery Service Tenant is not configured for DeliveryEstimation
* CHANNEL\_NOT\_SUPPORTED The channel is not configured for DeliveryEstimation
* INTERNAL\_SERVER\_ERROR Unexpected error occurred when processing the request
* LOCATION\_NOT\_FOUND The location is not configured for DeliveryEstimation
Allowed values: `B2CE_TENANT_NOT_FOUND`, `SHIPPING_CARRIER_METHOD_NOT_FOUND`, `DELIVERY_ESTIMATION_TENANT_NOT_FOUND`, `CHANNEL_NOT_SUPPORTED`, `INTERNAL_SERVER_ERROR`, `LOCATION_NOT_FOUND`.
* `message` (_string_, required)
### AttributeSet
* `groupEligibilityExclusion` (_array of string_) List of groups from which this attribute set is excluded
### InventoryInfo
* `onHand` (_integer_) On-hand inventory quantity
* `availableToOrder` (_integer_) Available to order quantity
* `availableToFulfill` (_integer_) Available to fulfill quantity
* `attributeSet` (_AttributeSet_)
# Commerce Einstein Activity Tracking API
Commerce Einstein product recommendations require activity tracking data. For example, tracking the viewProduct activity provides insight into top-viewed products. The Activity Tracking API provides access to these activities for use in recommendations.
The [Commerce Einstein Recommendation Validator](https://chrome.google.com/webstore/detail/commerce-cloud-recommenda/dobmbolmcejainkefklnpkjbaibgjihn?hl=en-US) extension helps with preliminary validation when integrating Commerce Einstein Activity Tracking on Salesforce production instances. This extension is available only for the Google Chrome browser. You can search for and install the B2C Commerce Recommendation Validator extension from the Chrome Web Store.
## View Product Activity
Trigger the viewProduct activity when a shopper views a Product Detail page. Don’t fire if a product is displayed via a recommendation, search result, or any other means.
**note:** If you replace the Product Detail Purchase Options component with a custom component, implement the viewProduct activity to ensure that Commerce Einstein Recommendations use cases generate results based on shopper or buyer view behavior.
Parameters
- product—The product that the customer viewed. An object with an 18-character product ID.
- sku—(Optional) A unique stock keeping unit identifier for the product.
Example usage
```nolang
trackViewProduct({ id: '01t000000000000001', sku: 'sku123' });
```
## View Recommendations Activity
Trigger the viewReco activity when a recommendation is displayed to the customer. Implement this activity when building a custom Commerce Einstein recommendations component.
**note:** If you calculate a recommendation but don’t show it to the customer—for example, it doesn’t have as many results as you like—don’t fire this activity.
Parameters
- recommenderName—The name of the recommender.
- recoUUID—A string representing the unique ID for this recommendation response.
- products—The products displayed to the customer. A list of one or more 18-character product IDs.
- sku—(Optional) A unique stock keeping unit identifier for the product.
Example usage
```nolang
trackViewReco(
'similar-products',
'123-456',
[{ id: '01t000000000000001', sku: 'sku123' }, { id: '01t000000000000002', sku: 'sku456' }]
);
```
## Click Recommendations Activity
Trigger the clickReco activity when a recommended product is clicked and the customer is taken to the product detail page. Implement this activity when building a custom Commerce Einstein recommendations component.
Parameters
- recommenderName—The name of the recommender.
- recoUUID—A string representing the unique ID for this recommendation response.
- product—The product that the customer clicked. An object with an 18-character product ID.
- sku—(Optional) A unique stock keeping unit identifier for the product.
Example usage
```nolang
trackClickReco('similar-products', '123-456', { id: '01t000000000000001', sku: 'sku123' });
```
## Add To Cart Activity
Trigger the addToCart activity when a shopper adds a product to the cart.
**note:** If you replace the Product Detail Purchase Options component with a custom component, implement the addToCart activity to ensure that Commerce Einstein Recommendations use cases generate results based on shopper or buyer view behavior.
Parameters
- product—The product that the customer adds to cart. An object with an 18-character product ID.
- sku—(Optional) A unique stock keeping unit identifier for the product.
- quantity—(Optional) The total number of this item in the cart.
- price—(Optional) The price of each individual unit of this product.
- originalPrice—(Optional) The original price of each individual unit of this product.
Example usage
```nolang
trackAddProductToCart({ id: '01t000000000000001', sku: 'sku123', quantity: 2, price: '9.99', originalPrice: '10.99' });
```
**See Also**
- [Commerce Einstein APIs](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-einstein-apis.md)
- [Prepare Commerce Einstein to Use Custom Components](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-prepare-einstein-custom-comps.md)
- [Create a Custom Recommendations Component for B2C Stores Using Commerce Einstein APIs](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-create-b2c-cust-ein-reco-comp.md)
- [Create a Custom Recommendations Component for B2B Stores Using Commerce Einstein APIs](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-create-b2b-cust-ein-reco-comp.md)
# Commerce Einstein APIs
Use Activity Tracking and Product Recommendation APIs to call Einstein Recommendations for your Salesforce Commerce B2C and B2B stores. These APIs provide access to underlying data behind Einstein Recommendations and enable modification of the front-end experience with custom Lightning web components or Aura components.
Einstein product recommendations require activity tracking data. For example, tracking the viewProduct activity provides insight into top-viewed products. The Activity Tracking API provides access to these activities for use in B2B and B2C Einstein Recommendations components.
Calls to the Product Recommendation API deliver Einstein recommendations. For Salesforce Commerce for B2C Einstein Recommendations components, the API is accessed using a [wire adapter](https://lwc.dev/guide/wire_adapter). The Product Recommendation API returns a set of products to populate the Einstein Recommendations component.
For Salesforce Commerce for B2B Einstein Recommendations components, use the Commerce Einstein Recommendations Connect REST API to select and deliver recommendations. Using the Connect REST API ensures appropriate product entitlement filtering before recommendations are delivered.
**See Also**
- [Prepare Commerce Einstein to Use Custom Components](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-prepare-einstein-custom-comps.md)
- [Create a Custom Recommendations Component for B2C Stores Using Commerce Einstein APIs](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-create-b2c-cust-ein-reco-comp.md)
- [Create a Custom Recommendations Component for B2B Stores Using Commerce Einstein APIs](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-create-b2b-cust-ein-reco-comp.md)
- [Commerce Einstein Recommendations API Reference](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-einstein-recs-api-ref.md)
# Commerce Einstein Recommendations API Reference
Modifying Einstein Recommendations interfaces in your B2B Commerce stores requires using the Activity Tracking API and a Product Recommendation API. These APIs provide access to the underlying data behind Einstein Recommendations and enable modification of the front-end experience with custom Lightning web components.
**See Also**
- [Commerce Einstein Activity Tracking API](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-activity-tracking-api.md)
- [B2B Commerce Einstein Product Recommendations API](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-einstein-b2b-reco-api-ref.md)
# Commerce LWR Storefront Performance Best Practices
Great performance is critical to the success of your LWR Commerce storefront, as fast loading sites can have [3 to 5 times higher conversion rates](https://www.portent.com/blog/analytics/research-site-speed-hurting-everyones-revenue.htm) than slower sites.
Follow these recommended best practices to optimize your storefront's overall performance.
- [Performance Measurement Best Practices](#performance-measurement-best-practices)
- [CDN Caching Best Practices](#cdn-caching-best-practices)
- [Component Best Practices](#component-best-practices)
- [Image and Resource Optimization Best Practices](#image-and-resource-optimization-best-practices)
- [Network Optimization Best Practices](#network-optimization-best-practices)
- [Configuration Best Practices](#configuration-best-practices)
Also, if you are currently using an Aura storefront, we recommend that you [migrate](https://developer.salesforce.com/docs/commerce/lwr-migration/overview) to an LWR storefront for optimal performance.
## Performance Measurement Best Practices
Effective performance measurement is key to understanding and improving your storefront’s performance. Take measurements before and after each change to see its impact, analyze the results, and iterate accordingly.
Use industry-standard performance tools and metrics. Get familiar with [Core Web Vitals](https://web.dev/articles/vitals), which captures different facets of user-perceived performance, affecting how Google [ranks your storefront pages](https://developers.google.com/search/docs/appearance/page-experience).
To collect synthetic performance data, we recommend using these tools against a representative mobile device on a 4G connection:
- [Google Lighthouse](https://developer.chrome.com/docs/lighthouse/overview) is an open-source, automated tool that evaluates the quality of web pages based on various criteria, including performance, accessibility, SEO, and progressive web app (PWA) best practices. It generates comprehensive reports highlighting improvement areas.
- [WebPageTest](https://www.webpagetest.org/) is a web performance tool providing diagnostics about how a page performs under a variety of conditions. WebPageTest is a freemium product with a generous free tier plan (300 runs per month). It's an advanced tool enabling developers to run deep-dive performance analysis.
- [Salesforce Page Optimizer](https://chromewebstore.google.com/detail/salesforce-page-optimizer/alkcnclapbnefkodhbkpifdkceldogka?pli=1) is a browser plugin that helps analyze and debug the performance of lightning applications.
After your storefront is deployed to production, continue to measure your site performance using Real User Monitoring (RUM). Consider using a third-party RUM tool for detailed measurements. Google Chrome automatically and anonymously collects performance data for all sites. If your site receives enough traffic in production, you can use [CrUX dashboard](https://developer.chrome.com/docs/crux/dashboard) to track your site's performance.
## CDN Caching Best Practices
Your CDN caching strategy greatly impacts your storefront performance.
By caching resources at the CDN level, you can significantly reduce load times for end users. CDNs store copies of static content closer to users, minimizing latency and speeding up access to data.
When you cache resources at the CDN level, data is served directly to the consumer from the CDN using HTTP/3 protocols. This approach increases server scalability by preventing requests from reaching the origin server.
All Salesforce resources are CDN cacheable, with Lightning Component caching [now on by default](https://developer.salesforce.com/docs/platform/lwc/guide/perf-cdn.html). Apex controller responses are also eligible for CDN caching via an annotation in the code. For more information, see the [section about Apex Controllers](#priority-3-apex-controllers).
Ensure resources from third-party origins have appropriate cache headers, whether they’re static (like .js files) or dynamic (like API results).
## Component Best Practices
LWR components are flexible and offer a wide range of choices. To use components in a way that optimizes performance, follow these best practices.
### Always Use Up-To-Date, Out-Of-The-Box Components
Before creating a custom component, check if a suitable out-of-the-box (OOTB) component is available and can meet your needs with CSS overrides. Built-in components available in the Experience Builder pallete are optimized for both client-side and server-side rendering and typically include the latest performance enhancements.
For existing sites, check your Experience Builder pages to ensure they don’t reference any component marked as "deprecated."
### Prefer Out-Of-The-Box APIs
Binding components to data can be done in various ways. However, to avoid unnecessary server requests and keep the data consistent on the page, prefer these APIs, listed in priority order.
#### Priority 1: Data Providers
Many pages and components use assigned data providers, which retrieve data in an optimized manner. We recommend that, where possible, your components use data from these providers using [LWR expressions](https://help.salesforce.com/s/articleView?id=commerce.comm_components_expressions.htm&type=5). Data providers are essential for accessing server-side data during server-side rendering (SSR).
#### Priority 2: Commerce Client APIs
If data providers aren't available or sufficient, use [client-side storefront APIs](https://developer.salesforce.com/docs/atlas.en-us.b2b_b2c_comm_dev.meta/b2b_b2c_comm_dev/b2b_b2c_comm_display_lwc_apis.htm) provided by the Commerce Runtime. These APIs are optimized with proper caching at both the CDN and browser levels.
Client-side storefront APIs are extensible and support custom fields. For example, if you add a custom field to the `Product2` object, the custom field's value is included in the payload when accessing products.
To minimize unnecessary API calls, don't invoke Connect APIs directly through `fetch()` or `XmlHttpRequest`. Instead, exercise the underlying Connect APIs via the client-side storefront APIs.
**Note:** Data providers, the preferred way to access data, are built on top of the client-side storefront APIs and benefit from their optimizations and support for custom fields.
Here is an example accessing the ApplicationContext:
```
export default MyComponent extends LightningElement {
@wire(AppContextAdapter)
wireAppContext({ data, error, loaded }) {
this.appContext = data;
}
myMethod() {
if(this.appContext) {
...
}
}
}
```
#### Priority 3: Apex Controllers
If data providers and Commerce Client APIs aren’t available or sufficient, create custom Experience APIs (Backend For Frontend - BFF) using Apex controllers. Optimize these APIs for the pages where they’re used and minimize the number of APEX calls. It's also very important to make the API result cacheable when appropriate.
- Tailor and optimize your custom APIs for the pages where they’re used.
- Make less than three Apex calls. Aggregate (batch) the data into a single call when they’re related.
- Make the API result cacheable for both the CDN and the browser by annotating the Apex method with `@AuraEnabled(cacheable=true,scope='global')`.
- If CDN cacheable isn’t appropriate (for example, the call executes in the user context), enable browser caching by annotating the Apex method with `@AuraEnabled(cacheable=true)`.
- Prefer using [Platform Cache](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_cache_namespace_overview.htm) over accessing the database directly. Platform Cache is faster than querying the database and scales better when you [follow Platform Cache best practices](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_platform_cache_best_practices.htm).
- Minimize the number of SOQL requests. Batch all SOQL requests if possible.
#### APIs to Avoid
Some Salesforce APIs are designed to support B2B and transactional applications:
- **UI APIs:** These are designed for transactional applications and their results aren’t cached, leading to SOQL requests on the server.
- **Access to permissions:** Salesforce provides a convenient way to check permissions with perm lookup, through `@salesforce/userPermission`. See [@saleforce/userPermission](https://developer.salesforce.com/docs/platform/lwc/guide/reference-salesforce-modules.html#salesforceuserpermission) and [@salesforce/customPermission](https://developer.salesforce.com/docs/platform/lwc/guide/reference-salesforce-modules.html#salesforcecustompermission). Avoid checking permissions on the client. If necessary, consolidate them in a single Apex call and don't block page rendering based on permissions.
#### Other API Pitfalls
- Avoid the [n+1 query problem](https://stackoverflow.com/a/97253), where requests are sequentially dependent on each other. This problem often occurs when a list component retrieves a list of records and each list item component subsequently fetches additional data for each record. Instead, strive to parallelize execution and aggregate data retrieval as high as possible in your custom component tree.
- Avoid redundant data retrieval. Use one service call to get the necessary data and avoid having multiple service calls returning the same data. This is often seen in custom Apex controllers and is a bad practice.
- By default, the checkout process is designed to handle each step in sequence. Concurrent calls or changes to checkout entities, including [WebCart](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_webcart.htm), within the same checkout session are not supported.
## Image and Resource Optimization Best Practices
Effective image and resource optimization can significantly enhance the performance of your site.
### Optimize Image Delivery
A common mistake is downloading and rendering oversized images, such as a 2-MB image displayed as a vignette. Make the actual size of the image, in bytes, correspond to the surface area it occupies on the screen.
The Commerce platform provides the capability to dynamically resize images based on how they’re displayed on the screen and to return them in an optimized file format (like WebP and AVIF). To take advantage of this capability, make sure that:
- The image is displayed using an out-of-the-box (OOTB) component (preferred) or, for custom components, the image is displayed using `experience/picture` URLs. These components use the browser's responsive image capability to query images via an image optimization service.
- If you can't use these components, you can programmatically compose the proper URL with resizing capabilities using utilities built for `experience/picture` (for example, `createImageDataMap`).
We recommend uploading your images to Salesforce CMS to optimize their delivery. If you must host your own images, ensure proper CDN and browser caching is achieved with `cache-control` headers.
### Minimize the Number of Resources Required for a Page
Every resource -- image, Javascript, CSS, web font, AP Apex call -- takes time to download and hurts the overall page performance. For optimal site performance:
- Remove references to unused resources.
- Minimize how many resources are loaded and reduce the size of each resource.
## Network Optimization Best Practices
Optimizing network performance is crucial for ensuring fast load times and a smooth user experience. Follow these best practices to minimize latency and improve the efficiency of your network requests.
### Limit the Number of Origins
Reducing the number of origins from which assets are loaded can significantly improve your site's performance. Follow these guidelines to streamline asset hosting and reduce latency.
- Host all assets with Salesforce (preferred).
- If that's not possible, host them on a single origin that supports CDN and browser caching with proper `cache-control` headers.
- If the assets hosted on a third-party origin are critical for the page load, adding a ` ` ([mdn](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preconnect)) to the `` markup speeds up the initial HTTP connection time.
### Minimize the Number of Third-Party Scripts and IFrames
Including third-party scripts and IFrames can introduce performance bottlenecks and security risks. It's crucial to limit their use and optimize their loading to ensure your site remains fast and secure.
- Third-party scripts and IFrames can introduce performance bottlenecks and security risks. Only include third-party content that’s essential for the functionality of your site.
- Defer loading of non-essential third-party scripts until after the main content has loaded. This can be achieved using the `async` attribute on script tags.
- Regularly audit your third-party scripts and IFrames to ensure they’re still necessary and aren’t introducing unnecessary delays or vulnerabilities.
- Consider using alternatives to IFrames, such as embedding content directly into the page, to avoid the additional overhead and potential security issues they can cause.
By adhering to these best practices, you can optimize the network performance of your site, ensuring faster load times and a better user experience.
## Configuration Best Practices
Performance can be impacted by sub-optimal configurations across data and settings. We recommend reviewing you data and removing duplicate or inactive data, such as inactive or unused promotions.
We also recommend that you review configuration tradeoffs and enable settings that improve performance. For more information, see these topics.
- [Faster Add to Cart](https://help.salesforce.com/s/articleView?id=commerce.comm_faster_add_to_cart.htm&type=5)
- [Reduce Entitlement Checks](https://help.salesforce.com/s/articleView?language=en_US&id=commerce.comm_search_skip_entitlement_check.htm&type=5)
- [Displayable Fields](https://help.salesforce.com/s/articleView?id=commerce.comm_displayable_fields_top.htm&type=5)
- [Secure Browser Caching](https://developer.salesforce.com/docs/platform/lwc/guide/perf-secure-browser-caching.html)
# Commerce Payment Component Options
Options include standard and custom components for card payment or purchase order processing. For client-side implementations, you can also build a custom payment component, or adapt an existing one.
| Required Editions |
| ----------------------------------------------------------------------- |
| Available in: **Enterprise**, **Unlimited**, and **Developer** Editions |
| Available in: B2B Commerce and B2B2C Commerce |
## Commerce Payment Components
Choose the Payment or Dual Payment component for server-side B2B store implementations. The dual component processes both card payments and purchase orders.
After you set up your B2B server-side payment gateway and payment service provider, use Experience Builder to select your payment component. If you have a third-party payment provider, you use the Payment or Dual Payment component.
- The Payment component includes a credit card option.
- The Dual Payment component includes both a credit card option and a purchase order option and is for B2B implementations only.
To use either of these payment components see [Customize Payments in Checkout](https://help.salesforce.com/s/articleView?id=commerce.comm_checkout_customize_payments.htm).
## Salesforce Payments Component
The Salesforce Payments component accepts a variety of payment methods including digital wallets. Customizable in Experience Builder, the Salesforce Payments Component also supports B2B purchase order business models.
If you have Salesforce Payments:
- Use the Salesforce Payments component. Adminstrators confgure the component payment keys and optionally enable saved payment methods. If you have a B2B store, you can also choose to show a purchase order option.
- If you have Salesforce Payments and you want to provide digital wallet payment options, add and configure the Express Checkout component. Express Checkout supports Apple Pay, Google Pay, PayPal, and Venmo.
To implement the Salesforce Payments component, see [Customize Payouts in Checkout](https://help.salesforce.com/s/articleView?id=commerce.comm_checkout_customize_payments.htm) and [Add Salesforce Payments Features to Store Checkout](https://help.salesforce.com/s/articleView?id=commerce.comm_custom_checkout.htm&type=5).
## Custom Payment Component
A custom, client-side payment component interacts directly with a payment provider. Implementation requires creating a custom LWC checkout UI component that is provisioned to interact directly with the payment gateway.
For more on the architecture, flow, and advantages of a custom client-side component, see [Set Up Client-Side Payment Processing](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-checkout-payment-clientside-container.md).
## Purchase Order Component
The Purchase Order Component supports B2B stores that don’t require a payment gateway.
While not technically a payment, a purchase order in a B2B (LWR) store can “stand in” as a form of payment. Buyers enter a purchase order number and place an order. (If there is neither payment authorization nor purchase order for the cart, the order cannot be placed.) The purchase order number is used downstream system for invoicing and payment processing. Purchase orders do not trigger payment flows out of the box within the Salesforce system.
If you want your B2B store to accept purchase orders only, use the Purchase Order Component. To implement a Purchase Order component, see [Customize Payments in Checkout](https://help.salesforce.com/s/articleView?id=commerce.comm_checkout_customize_payments.htm).
# Commerce Payment Gateway
Payment Integration in checkout is built on the foundation of the commerce payment framework in Salesforce that is used in other products in the Salesforce portfolio such as Revenue Cloud and Order Management. This framework allows you to author an Apex class that acts as an adapter between Salesforce and the payment gateway. The framework handles the creation of payment specific records in the Salesforce system, logging calls to the gateway for auditing, idempotency in a secure, PCI-compliant fashion.
# Commerce Payment Gateway Options
Options include AppExchange payment provider packages, Salesforce Payments, or a custom gateway integration. Salesforce Payments and some AppExchange payment providers may be interoperable across the B2B Commerce solution and Salesforce Order Management.
| Required Editions |
| ----------------------------------------------------------------------- |
| Available in: **Enterprise**, **Unlimited**, and **Developer** Editions |
| Available in: B2B Commerce and B2B2C Commerce |
## AppExchange Gateway Integration
Select a payment provider listed on the Salesforce AppExchange by using Commerce app in your org. AppExchange providers are vetted for security, compatibility, and ease of integration by Salesforce.
To check availability and select a payment package for your org instance, browse [AppExchange](https://help.salesforce.com/s/articleView?id=commerce.comm_set_up_payment.htm)in your Commerce app. Always check the listings for a package that supports a B2B or B2C store.
For a full, current list of Salesforce partners for Commerce, see [AppExchange>Payment Processing](https://appexchange.salesforce.com/appxstore?filter=a0L3000000OvSOwEAN)
## Salesforce Payments Gateway Integration
Salesforce Payments is the established path for implementing payment on Salesforce Commerce and is the fastest way to get up and running with payments in your Salesforce Commerce B2B store. A native integration with Stripe, Salesforce Payments supports an extensive set of capabilities out of the box and intricate connectivity to Salesforce Order Management.
To set up a Salesforce Payments gateway, administrators use the Commerce app to perform steps that:
- Establish a data channel (an Experience Cloud site) for payment data to flow from the payment gateway to Salesforce Payments
- Create a Salesforce Payments merchant account that accepts electronic payments from a variety of payment methods including customer-saved methods and Apple Pay
- Optionally use the Payments app to associate Stripe with the merchant account to generate B2B and B2C payment intent records.
To understand and implement a Salesforce Payments gateway, see [Set Up Salesforce Payments](https://help.salesforce.com/s/articleView?id=commerce.payments_setup_intro.htm&type=5).
## Custom Gateway Integration
A custom payment gateway supports a client-side payment component that you create or adapt. For server-side implementations, the custom work requires writing the Apex adapter that uses our out-of-the-box payment components. The gateway interacts directly with the UI component, which then issues a PostAuth validation to register and process the transaction for Salesforce Order Management.
To understand and implement a custom client-side payment integration, see [Client-Side Payment Processing Flow](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-checkout-payment-clientside-setup.md).For more on server-side payment integration, see [Set Up Server-Side Payment Processing](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-checkout-payment-serverside-setup.md).
# Commerce Payment Gateway Processing
The Commerce Payment Gateway connects your store and third party payment providers. The gateway validates and processes payment API requests including tokenization, authorization, capture, refund, and other checkout API requests.
| Required Editions |
| ----------------------------------------------------------------------- |
| Available in: **Enterprise**, **Unlimited**, and **Developer** Editions |
| Available in: B2B Commerce and B2B2C Commerce |
The Commerce Payments Gateway uses the CommercePayments Apex namespace. For more information, see the [Apex Reference Guide](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_namespace_commercepayments.htm).
The Commerce Payments Gateway parses key object fields passed by the UI Checkout components. These fields include data to tokenize and authorize the payment request. For example, the Payments Gateway requires a tokenize request to pass this information.
```
cardPaymentMethod: {
cardHolderName: ,
cardNumber: ,
expiryMonth: ,
expiryYear: ,
cvv:
}
address: {
street: ,
city: ,
state: ,
postalCode: ,
country:
}
```
Authorization, capture, refund, and other requests also pass these objects. Review the Stripe adapter samples in the [Payments Reference Package](https://github.com/forcedotcom/commerce-on-lightning/tree/main-2/examples/b2c/checkout/payment-gateway-integration) to see how objects for transmission to Stripe are handled.
Examples for the Salesforce Payment Adapter include:
- `tokenizeRequest → commercePayments.PaymentMethodTokenizationRequest`
- `authRequest → commercePayments.AuthorizationRequest`
- `captureRequest → commercePayments.CaptureRequest`
- `refundRequest → commercePayments.ReferencedRefundRequest`
# Commerce SFDX Environment Setup
Salesforce recommends the Salesforce Developer Experience (SFDX) environment for building Lightning web components (LWC), and for custom tax, shipping, and payment integration packages and extensions. SFDX provides easy access to Salesforce extensions and GitHub repositories containing LWC templates and reference packages. SFDX also integrates with Salesforce CLI, the Visual Studio Code editor with the Salesforce Extension Pack, and plug-ins to quickly deploy packages and components to scratch orgs and stores.
| Required Editions |
| ----------------------------------------------------------------------- |
| Available in: **Enterprise**, **Unlimited**, and **Developer** Editions |
| Available in: B2B Commerce |
## Install the SFDX CLI
The Salesforce DX (SFDX) CLI synchronizes your source code between the Salesforce orgs that you deploy to and your version control system.
Install the CLI. See [Install the Salesforce SFDX CLI](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.get_started_cli).
To confirm installation, open a command or terminal window and enter `sfdx`.

## Install the Visual Studio Code Editor
The free Visual Studio (VS) Code editor is an ideal development environment for creating, debugging, and deploying Salesforce Lightning web components and integration packages and extensions.
The free VS Code editor is open-source and optimized for cloud and web coding. The project folder combines, compiles, and displays the output of the HTML, JavaScript, and CSS files for your component.
- [Install the open source Visual Studio Code editor](https://code.visualstudio.com/download).
## Get Salesforce Extensions for VS Code Editor
The VS Code editor provides access to Salesforce extensions that support creating integration packages and custom components for B2B and B2C stores created with an LWR template. The extensions include features for working with scratch orgs, sandboxes, and DE orgs, Lightning web components (LWC), and more.
For more information, see the [Salesforce Extensions for VS Code Overview](https://developer.salesforce.com/tools/vscode/).
1. Open the VS Code app.
2. Navigate to **View** | **Extensions**.
3. In the search field, enter `Salesforce`.
4. To install the package, click **Salesforce Extension Pack** (v. 51.4.0 or later).
5. To confirm installation in the VS Code Editor, open the Command Palette by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS) and enter `sfdx`.
Confirmation looks like this:

The Salesforce Extension Pack includes:
- Salesforce SFDX CLI integration for VS Code
- ESLint JavaScript integration for VS Code
- LWC for VS Code, which uses the VS Code HTML server to provide code-editing features for the LWC program model, including syntax highlighting, code completion, and file outlining
To display a list of the installed extensions, click the Extensions icon in the left navigation pane or press Ctrl+Shift+X (Windows) or Cmd+Shift+X (macOS) and scroll to view them all.

For an overview, see [Salesforce Extensions for LWC](https://developer.salesforce.com/tools/vscode/en/lwc/writing)

# Commerce Solution for Consumer Goods

## Consumer Good Companies Connect the Consumer
Salesforce for Consumer Goods enables brands to take control of their brand experience and build a personalized, intelligent, data-rich B2C Commerce experience. Companies can meet their shoppers online and build an ecommerce presence quickly. And with insights on customer behavior, companies can increase brand loyalty with intelligent merchandising, subscriptions, payments, customizable content, and a connected experience through delivery and fulfillment.
Also, Consumer Packaged Goods companies who sell through retailers can use B2B Commerce to reach smaller retailers such as convenience stores.
## Business Value
Building D2C isn’t merely about creating a channel to sell products. It’s about creating an experience and building personalized, one-on-one engagements. Why? Consumers want a relationship with your brand.
- 52% of customers already visit a brand’s website with the intent to purchase. [Source](https://www.salesforce.com/uk/blog/2020/07/building-the-right-customer-experience.html#:~:text=A%20D2C%20report%20found%20that,with%20the%20intent%20to%20purchase.)
- 80% of consumers say the experience a company provides is as important as the product or services it offers. [Source](https://www.salesforce.com/news/stories/state-of-the-connected-customer-report-outlines-changing-standards-for-customer-engagement/)
D2C drives growth, increases revenue, and provides access to first-party data that can transform the consumer experience that you offer. This data can inform everything from product decisions to retailer relationships, and it can even help you unlock new consumer segments.
D2C also means directing organizational change, selecting the right team to craft a consumer-centric approach, and balancing existing relationships with channel partners. In some instances, that means opening up a new B2B Commerce channel.
For more information, check out the [Going Direct to Consumer](https://www.salesforce.com/form/commerce/conf/direct-to-consumer/?leadcreated=true&redirect=true&DriverCampaignId=cta-body-promo-158&FormCampaignId=7010M000002E47OQAS) guide.
## Consumer Goods Use Cases
With consumer behavior rapidly changing, B2C Commerce makes it easy to launch your ecommerce site and get to the market in weeks, not months. With B2C Commerce:
- Launch a direct to consumer storefront
- Implement a subscriptions offering
- Integrate payments
- Extend commerce to new channels and touchpoints
- Connect order management and inventory
- Open a B2B channel
For more information, see [Salesforce Consumer Goods](https://www.salesforce.com/solutions/industries/consumer-goods/overview/).
## Platform Features and Accelerators
Building a digital shopping experience requires a best-in-class commerce toolset to connect to shoppers anytime, anywhere. The B2C Commerce Platform toolset can help create unified, intelligent digital commerce experiences.
### Top Features for Consumer Goods
- [B2C Commerce Storefront Reference Architecture](https://developer.salesforce.com/docs/commerce/sfra) (Mobile First)
- Multiple and Localized Site Management
- SEO Optimization and URL Management
- Onsite Search
- Product Management (Price Books, Catalogs, Navigation)
- Marketing, Campaigns, and Promotions Engine
- Customer Profile and Account Management
- Customer Segmentation
- AB Testing
- Page Designer and Content
- Dynamic Imaging Service
- Inventory
- Analytics
- Privacy Tools
- Embedded CDN
- Integrated Payments
- Guided Selling
- Curbside Pickup
- Headless API Experience
- AI-Driven Capabilities Powered by Einstein
- Einstein Predictive Sort
- Einstein Product Recommendations
- Einstein Commerce Insights
- Einstein Search Dictionaries
- Einstein Search Recommendations
- Salesforce Order Management
- Ecosystem
- [Agentforce Commerce Partner Marketplace](https://www.salesforce.com/products/commerce-cloud/partner-marketplace/)
- [AppExchange](https://appexchange.salesforce.com/)
- Agentforce Marketing and Agentforce Service Integration
## Implementation Overview
Developers have two paths:
- Build on the Salesforce Commerce Platform using developer tooling, sample apps, headless APIs, and best practices.
- Launch Commerce Quick Start Commerce Solutions that provide out-of-the-box (OOTB) solutions for Direct to Consumer, Subscriptions, Channels, Grocery, Quick Service Restaurants, along with B2B Commerce. Developers can offload implementation and managed services to partners in these offerings.
### Salesforce Commerce Platform
### B2C Developer Tools
- [Agentforce Commerce Developer Center](https://developer.salesforce.com/developer-centers/commerce-cloud)
- Open Commerce API (OCAPI)
- Salesforce Commerce API
- Software Development Kits (SDK)
- Mulesoft Connector for Data API
### B2C Commerce
- [Build Your Ecommerce Site with Salesforce B2C Commerce](https://trailhead.salesforce.com/en/content/learn/trails/build-ecommerce-site-with-cc-digital?trailmix_creator_id=bcommerce&trailmix_slug=get-started-with-salesforce-b-2-c-commerce)
- [Develop for Salesforce B2C Commerce](https://trailhead.salesforce.com/en/content/learn/trails/develop-for-commerce-cloud)
- Headless Commerce: [Basics](https://trailhead.salesforce.com/en/content/learn/modules/b2c-headless-commerce-basics), [Implementation Strategies](https://trailhead.salesforce.com/en/content/learn/modules/b2c-headless-implementation-strategies), [PWA Kit & Managed Runtime](https://trailhead.salesforce.com/en/content/learn/modules/commerce-pwa-kit-and-managed-runtime)
- [Configure On-Demand Sandboxes](https://trailhead.salesforce.com/content/learn/modules/b2c-on-demand-sandbox)
- [Documentation Hub: B2C & OMS](https://help.salesforce.com/s/articleView?id=cc.b2c_data_input_output_overview.htm&type=5)
### Order Management
- [Getting Started with Salesforce Order Management](https://trailhead.salesforce.com/content/learn/modules/om-salesforce-order-management)
- [Salesforce Order Management Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.order_management_developer_guide.meta/order_management_developer_guide/order_management_developer_guide_intro.htm)
### B2B Commerce
- [Salesforce B2B Commerce Basics](https://trailhead.salesforce.com/en/content/learn/modules/b2b-commerce-basics)
- [Administer Salesforce B2B Commerce on Lightning Experience](https://trailhead.salesforce.com/en/content/learn/trails/administer-salesforce-b2b-commerce-on-lightning-experience)
- [Documentation Hub: B2B](https://help.salesforce.com/articleView?id=commerce.b2b_commerce.htm&type=5)
### Salesforce Professional Services
Salesforce Professional Services teams help you every step of the way. With deep industry and commerce expertise, customer success experts can help plan, scope, and build your next Consumer Goods project.
## Additional Consumer Good Resources
Launch a Commerce Quick Start Solution that provides quick to market OOTB solutions for Direct to Consumer and B2B use cases. Developers can offload implementation and managed services to partners in these offerings.
[Quick Start for Direct-to-Consumer](https://www.salesforce.com/content/dam/web/en_us/www/documents/campaign/quick-start-commerce-solutions/commerce-for-consumer-essential-goods-data-sheet.pdf)
Launch a direct-to-consumer commerce site for essential and consumer goods.
[Quick Start for Subscriptions](https://www.salesforce.com/content/dam/web/en_us/www/documents/campaign/quick-start-commerce-solutions/quick-start-commerce-for-subscriptions.pdf)
Give customers an easy way to stock up on products they love.
[Quick Start for Channels](https://www.salesforce.com/content/dam/web/en_us/www/documents/campaign/quick-start-commerce-solutions/commerce-for-channels.pdf)
Extend your ecommerce to new channels.
[Quick Start for Grocery and Quick Service](https://www.salesforce.com/content/dam/web/en_us/www/documents/campaign/quick-start-commerce-solutions/commerce-for-grocery-data-sheet.pdf)
Sell essential grocery and food items online.
[Quick Start for B2B Commerce](https://www.salesforce.com/content/dam/web/en_us/www/documents/campaign/quick-start-commerce-solutions/commerce-for-B2b-data-sheet.pdf)
Deploy a B2B Commerce storefront for self-service ordering.
# Commerce Webstore Checkout Orders API
Use for simple, synchronous checkout scenarios with minimal customization. The Commerce Webstore Checkout Orders API is also referred to as Place Order V1.
**Endpoint:** POST [`/commerce/webstores/{webstoreId}/checkouts/{activeOrCheckoutId}/orders`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_webstore_checkouts_place_order.htm)
**How it works:**
- Invoke single-step Place Order API (no request body required).
- The API performs all validations and places the order in a single call.
- On success, returns 201 Created with Order Reference Number (ORN).
- On failure, returns 422 Unprocessable Entity.
**Call after:**
- Payment APIs have completed.
**Supported cart states:**
- Checkout
- PendingClosed (returns existing ORN)
**Execution flow:**
- Validations, inventory, coupon processing, and order placement execute in a single call.
- Cart-to-order processing runs asynchronously after API call.
# Commerce Webstore Checkout Place Order Action API
Use for advanced scenarios requiring better control, extensibility, and resilience through a staged workflow. The Commerce Webstore Checkout Place Order Action API is also referred to as Place Order V2 or Streamlined Place Order.
**Endpoint:** POST [`/commerce/webstores/{webstoreId}/checkouts/{activeOrCheckoutId}/orders/actions`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_webstore_checkouts_place_order_v2.htm)
**Prerequisite:** Streamlined Place Order enabled for webstore. See [Streamlined Place Order](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-d2c-comm-streamlined-place-order.html)
**How it works:**
- The request must include an action in the body: `prepare` or `submit`.
- Two-step process:
- Prepare – Performs validations and readiness checks.
- Submit – Finalizes and creates order.
- On success, returns 200 OK (Submit returns ORN).
- On failure, returns 422 Unprocessable object.
**Orchestration:**
- Call Prepare before payments.
- Process payments.
- Call Submit after payments.
#### Prepare Action
Validates whether cart is ready for order placement.
**Supported cart states:**
- Checkout
- PendingClosed (returns early if already in this state).
**Extension support:**
- Custom validations via `Commerce_Domain_Checkout_PlaceOrder`. See [CheckoutPlaceOrder](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/CheckoutPlaceOrder.html).
#### Submit Action
Finalizes and creates order.
**Supported cart states:**
- Checkout
- PendingClosed (returns existing OrderReferenceNumber (ORN) if already in this state)
**Execution flow:**
- Validations, inventory, coupon processing in Prepare.
- Order placement in Submit.
- Cart-to-order processing runs asynchronously after Submit.
**Extension support:**
- Custom validations via `Commerce_Domain_Checkout_PlaceOrder`. See [CheckoutPlaceOrder](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/CheckoutPlaceOrder.html).
# Community
At Salesforce B2C Commerce, we want to encourage our developer community to connect, share, and collaborate—whether that’s through official or unofficial channels!
## Official Channels
Through official channels, Salesforce employees can speak directly about Salesforce products, procedures, and policy. When Salesforce employees participate in the “unofficial” community, nothing they say or do can be endorsed by Salesforce. For example, product announcements or positioning statements can _only_ be made through official channels.
Our official channels include:
- [Trailblazer Community](https://trailhead.salesforce.com/trailblazer-community/groups/0F94S000000H1fESAS)
- [Idea Exchange for Commerce](https://trailblazer.salesforce.com/ideaSearch?sort=2&filter=Commerce)
- [Partner Community](https://partners.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F93A0000009SFY)
## Unofficial Slack
Alongside official channels, there’s also the [Salesforce B2C Commerce “Unofficial” Slack](https://sfcc-unofficial.slack.com/home) community. It was created by B2C Commerce users a few years ago and has steadily grown over the years.
The “Unofficial” Slack is a place for developers to work together to solve the problems they encounter on a daily basis. It also gives members a place to discuss Salesforce B2C Commerce in a free and open environment. It’s run independently from Salesforce, with its own [administrators](https://github.com/sfcc-unofficial/docs/blob/master/admins.md) and [Terms of Use](https://github.com/sfcc-unofficial/docs/blob/master/terms-of-use.md).
Here are some key channels to join: [#scapi](https://sfcc-unofficial.slack.com/archives/C01AWMT7GSZ), [#headless](https://sfcc-unofficial.slack.com/archives/CH4U3SBKJ), and [#pwa-kit](https://sfcc-unofficial.slack.com/archives/C02KUCHDEKH).
With the [acquisition of Slack](https://www.salesforce.com/news/press-releases/2021/07/21/salesforce-slack-deal-close/), Salesforce provides sponsored access to features like expanded history. Beyond this sponsorship arrangement, Salesforce has no other involvement in how the community is run. The community maintains full independence from Salesforce.
Join the community today! Anyone can join in one of two ways:
1. Someone who is already in the community can extend an invitation to you.
2. Complete this [Google Form](https://docs.google.com/forms/d/e/1FAIpQLSdy875PlJuib35naCkr3-Frn2qtaSuuRgYezRSb2uBYkhXt7g/viewform) to request access.
You don’t have to be affiliated with a B2C Commerce customer or partner to join.
See more details on [joining](https://github.com/sfcc-unofficial/docs/blob/master/README.md) and [getting started](https://github.com/sfcc-unofficial/docs/blob/master/getting-started.md) on GitHub.
**note:** For urgent issues that require timely resolution, contact [Salesforce Support](https://help.salesforce.com/s/support/).
# Compatibility Mode Changes
To upgrade to the latest compatibility mode, you must understand what changed between modes, to make the corresponding changes to your code.
Your site uses one of the following compatibility modes: 10.4, 10.6, 13.6, 15.5, 16.1, 16.2,17.7, 18.2, 18.10, 19.10, 21.2, or 22.7.
The `dw.system.System.getCompatibilityMode()` method returns the compatibility mode of the custom code version that is currently active. The compatibility mode is returned as a number, for example, compatibility mode 15.5 is returned as 1505.
## 22.7
With compatibility mode 22.7, the B2C Commerce server-side JavaScript engine supports more elements from ECMAScript 6 (ES6) and later. Access new and expanded features, including top-level built-in types and methods for existing classes.
- Shorthand property names
- New JavaScript primitive type `bigint`, replaces `dw.util.BigInteger`
- Template literal support
- `String.raw`
- `globalThis`
- Exponential operator
- `Object.values` / `Object.entries` / `objectfromEntries` / `Number.EPSILON`
- dw.order.Order.getOrderExportXML() API v2 with strict argument validation and extended RSA algorithm support
- The encryption parameter handling for encrypted and masked payment instrument data in `dw.order.Order#getOrderExportXML` API is revised.
- Data Includes
- Credit card number
- Bank account number
- Bank account driver's license number
- Change Details
- `dw.order.Order.getOrderExportXML(encryptionAlgorithm, encryptionKey, encryptUsingEKID)` was removed entirely. This method was deprecated because the `encryptUsingEKID` parameter was never used. To return encrypted payment instrument data with the given algorithm or key, use `dw.order.Order.getOrderExportXML(encryptionAlgorithm, encryptionKey)` instead. To return payment instrument data unmasked, use `dw.order.Order.getOrderExportXML()`.
- dw.order.Order.getOrderExportXML(encryptionAlgorithm, encryptionKey) no longer accepts an invalid encryption argument, which includes null, blank, or otherwise empty algorithms or keys.
- `dw.order.Order.getOrderExportXML(encryptionAlgorithm, encryptionKey)` supports the current RSA/ECB/OAEPWithSHA-256AndMGF1Padding encryption algorithm. Previously, the `encryptionAlgorithm` argument was ignored and the (now deprecated) algorithm RSA/ECB/PKCS1Padding was always used when a non-blank key was provided.
- `dw.order.Order.getOrderExportXML(encryptionAlgorithm, encryptionKey)` no longer accepts a null key, which was used as a “magic” value for returning the payment instrument data as masked instead of encrypted. Only use `dw.order.Order.getOrderExportXML()` to return masked payment instrument data.
## 21.7
- Any use of invalid characters in a cookie name, as described in RFC6265, which references RFC2068, now causes dw.web.Cookie to throw an exception.
The `dw.catalog.ProductInventoryRecord` class has the following updates
- The already-deprecated method `getOnHand()` has been removed.
- The allocation amount now requires an allocation reset date. For that reason, the `setAllocation(allocationAmount, allocationResetDate)` has replaced the `setAllocation(allocationAmount)` method, which has been removed.
- Product Inventory Records are now read-only in a storefront context. Thus, you can no longer call the following methods within a storefront context:
- `setAllocation(allocationAmount, allocationResetDate)`
- `setBackorderable(boolean)`
- `setInStockDate(Date)`
- `setPerpetual(boolean)`
- `setPreorderable(boolean)`
- `setPreorderBackorderAllocation(double)`
## 21.2
- The JavaScript server-side engine supports some ECMAScript 6 and later language elements.
- B2C Commerce JavaScript is based on Rhino JavaScript. Compatibility modes earlier than 21.2 use the ECMAScript 5 (ES5) language version. With 21.2, some ECMAScript 6 (ES6) language elements, standardized as ECMAScript 2015 and later, are supported. Keep in mind that ES6 isn’t completely compatible with ES5. ES6 introduces the following new keywords that can no longer be used as identifiers.
- In general: `class`, `export`, `extends`, `import`, `super`, `await`, `enum`
- In strict mode only: `implements`, `interface`, `package`, `private`, `protected`, `public`, `static`
- Compatibility mode 21.2 activates numerous B2C Commerce JavaScript changes, including many small fixes and changes to existing features. Some of the significant changes and new features are as follows:
- More features for strict mode.
- New JavaScript top-level built-in types, including Symbol, Map, Set, and typed arrays. The new types are designated as **API Versioned, From version 21.2** in B2C Commerce Script documentation.
- New methods for existing classes, for example `String`, `Number`, `Array`, `Math`, and `Object`. The new methods are designated as **API Versioned, From version 21.2** in B2C Commerce Script documentation.
- Support for Symbols.
- `for..of` loops.
- Arrow functions.
- Generator functions (functions that use `function *` syntax.)
- Shorthand method declarations. (Shorthand properties aren’t supported.)
- Destructuring of objects.
- More consistent timeout handling.
## 19.10
19.10 includes the following changes:
- Long running scripts now abort as expected after the timeout period. Previously, some scripts didn’t time out under some conditions.
- The classes `dw.svc.ServiceRegistry`, `dw.svc.ServiceDefinition`, and the subclasses of `dw.svc.ServiceDefinition` have been removed from the script API. These classes had been previously deprecated and replaced with `dw.svc.LocalServiceRegistry`. You can’t register `ServiceDefinitions` using an `init` script in `package.json`. The `init` scripts are no longer executed.
- Objects of unsupported types can no longer be stored at the session. Previously, if you used an unsupported type, you got a deprecation warning message. With 19.10, the session object refuses objects of unsupported types with an exception. If you implemented your storefront based on SiteGenesis, sometimes you have to adjust the code. In SiteGenesis, when a shopper logs in, the requested location is held in a session variable of type URL. In `guard.js`, change the type to string, as follows:
Change this:
```
session.custom.TargetLocation = browsing.lastUrl();
```
To this:
```
session.custom.TargetLocation = ''+browsing.lastUrl();
```
## 18.10
The `dw.util.StringUtils#formatNumber(number,format,locale)` API method now respects the regional settings of the locale for grouping and decimal characters.
Before Compatibility Mode 18.10, this method ignored the defined regional settings and used the format setting from Java for the specified locale.
## 18.2
Exceptions from JavaScript functions called by script API classes were wrapped as a SystemError. This situation led to issues if the exception was an APIException, because the additional properties weren’t accessible.
A method where this situation occurred is `dw.util.Transaction.wrap()`:
```
try {
dw.util.Transaction.wrap(function () {
throw new Error("my error");
});
} catch (e)
{
return {message: e.message, name: e.name};
}
```
Before Compatibility Mode 18.2, this example returned the unexpected result:
```
message: com.demandware.core.script.capi.ScriptingException: Error: test error (...) name: SystemError.
```
With 18.2 Compatibility Mode, the original exception object remains intact, which means the example returns the following message:
```
test error name: Error
```
## 17.7
APP-49849: Changed Argument Handling of ISML.RenderTemplate
The behavior of the `dw.template.ISML.renderTemplate()` method has changed slightly. The template execution is now scoped. All variables passed to the template are only placed in the dictionary temporarily. After the template finishes, the original pipeline dictionary is recovered. Previously, arguments passed into the template were placed in the global pipeline dictionary. Having the arguments in the global pipeline dictionary led to naming conflicts and changed values in the dictionary after the template returned.
**important:** Because this change is a breaking change, a new API compatibility mode was added. The new behavior is only activate if API mode is set to 17.7 or later.
## 16.2
With Compatibility Mode 16.2 it, encrypt and decrypt a message with a salt of ‘0’, using the Cipher class in the Salesforce B2C Commerce API. When using a previous compatibility mode, a system-defined salt was used if the developer passed a salt that consisted solely of bytes with value 0x00 or other characters that are represented by ASCII codes less than or equal to 0x20.
Compatibility Mode 16.1 used the following salt values:
- salt 0x7d, 0x60, 0x43, 0x5f, 0x02, 0xe9, 0xe0, 0xae (Base64 encoded fWBDXwLp4K4=) as the default salt in the cases mentioned previously for PBE-based encryption.
- salt 0x73, 0x2f, 0x2d, 0x33, 0xc8, 0x01, 0x73, 0x2b, 0x72, 0x06, 0x75, 0x6c, 0xbd, 0x44, 0xf9, 0xc1 (Base64 encoded cy8tM8gBcytyBnVsvUT5wQ==) as the default salt for AES-based encryptions.
If you must reproduce the behavior of compatibility modes before Release 16.2 on an instance that has 16.2 enabled, use these salts as the salt parameters to encrypt or decrypt.
## 16.1
APP-33920: ECMAScript 5 compliant behavior of global function _parseInt(String)_ in code compatibility version 16.1
Starting with B2C Commerce Script API (code compatibility) version 16.1, the _parseInt(String)_ function is ECMAScript 5 compliant. In older versions, the function was only compliant with ECMAScript 3. The difference is that with ECMAScript 5, octal number support was dropped. Numbers starting with leading zeros are now parsed to radix 10 instead of radix 8, as previously. If the dynamic radix determination isn't needed explicitly, the use of _parseInt(String, Number)_ is still recommended.
APP-34144: Map.Values() Returns a View to the Map in Code Compatibility Version 16.1
Starting with B2C Commerce Script API (code compatibility) version 16.1, the _Map.values()_ method now returns a view to a map the same way the _Map.keySet()_ and _Map.entrySet()_ methods did in earlier versions. Previously, the _Map.values()_ method returned an independent collection where modification didn’t change the map.
## 15.5
APP-32403: SiteGenesis Release 15.3 and 15.4 Developers Must Modify Their Code If Using the Release 15.5 B2C Commerce Script API
A recent change in the way the 15.5 B2C Commerce Script API handles global variables means that customers who have adopted SiteGenesis Releases 15.3 or 15.4 must explicitly declare the paths of global functions such as `dw.system.Logger` and `dw.web.URLUtils`.
Who Does This Affect?
This change affects only customers using SiteGenesis Releases 15.3 and 15.4, _and_ who have set the B2C Commerce Script API Compatibility Mode to 15.5. This change doesn't affect customers using B2C Commerce Script API Version 13.6 or using SiteGenesis 15.2 or earlier or SiteGenesis 15.5 or later.
How Does the Problem Appear?
If you’re using SiteGenesis Release 15.3 or 15.4 _and_ you’re using B2C Commerce Script API 15.5, you can't access the Cart page in SiteGenesis. You get an error in your log file as follows:
```
org.mozilla.javascript.EcmaError: ReferenceError:
"Logger" isn't defined.
(app_storefront_core/cartridge/scripts/cart/calculate.js#271)
in line 271
```
What Should I Do If This Happens to Me?
1. If possible, merge SiteGenesis Release 15.5 into your code, or
2. Use the SiteGenesis 15.5 version of `calculate.js`, or
3. In `calculate.js`, replace all calls to `Logger()` to the fully qualified version, as follows: `dw.system.Logger()`.
4. Only if you have no opportunity to fix the code to comply with the updated JavaScript standard set the compatibility mode to 13.6.
**note:** This change is a temporary fix until the required code changes are made.
APP-23919: Global Scope of Caller Not Accessible by Called Modules with Compatibility Version 15.5
The `require()` script now works properly within pipelines (Assign Node). Previously, global variables were shared between modules, which limited isolation and reusability. Global variables defined in a module script didn’t work, while they worked properly when requiring the module in another script.
See the following example:
TopLevelScript.ds
```
importPackage( dw.system );
var globalVariable = PIPELET_ERROR;
function execute( args : PipelineDictionary ) :
Number
{
return require("myModule");
}
```
MyModule.ds
```
var globalVariable;
module.exports = globalVariable || PIPELET_NEXT;
```
With compatibility version 15.5, the `PIPELET_NEXT` is returned, while previous compatibility versions returned a `PIPELET_ERROR`.
Activate the new behavior by selecting compatibility version 15.5.
Customer impact: Review your code for use of the `require()` script that relies on the leakage of variables from the caller scope into the module.
APP-30008: Cipher Methods Expect a Base64-Encoded Salt with Compatibility Version 15.5
Starting with API Version 15.5, all `dw.crypto.Cipher` methods expect the salt argument to be base64-encoded.
**note:** Passing undefined as salt is no longer possible, because it was previously used for some algorithms. With the new API version, you encounter an EncryptionException with the message base64 decoding of salt failed.
APP-30138: Module Lifetime Is Entire Request with Compatibility Version 15.5
With code compatibility version 15.5, modules are now loaded and instantiated only once per request. If within script code a `require()` call requests the module a second time, then the same instance as the first call is returned. This return of the same instance happens regardless of the location of the require call (pipeline, script files, or ISML files).
Previously, the module cache that was held within the implementation of `require()` wasn’t global per request, but belonged to the JavaScript context. For every new context, a new cache was created. Modules that were resolved in a script were therefore not visible to script sections contained in templates (for example, `isscript`) because scripts had their scope, and templates had another scope.
APP-30693: Log notification for changed methods in older API Versions
If a method behavior changes, but the method signature stays the same, and the method is still used with an old B2C Commerce Script API version active (also referred to as Compatibility Mode), B2C Commerce now writes notifications to the API log.
For example, if a fictitious class method apiClass.setMethod(String one) existed in the old B2C Commerce Script API Version 13.6 (which is the last active Compatibility Mode in 15.4) and the behavior changed with the new B2C Commerce Script API (a new Compatibility Mode) in Release 15.5, the usage of apiClass.setMethod in Release 15.5 executed on the old B2C Commerce Script API version 13.6 will log a message such as the following to the API log file:
```
API Method apiClass.setMethod(String) has been changed in a newer API Version.
Consider updating."
```
The same invocation on the newer B2C Commerce Script API (Compatibility Mode 15.5 after you activated this new API) will no longer log this type of message.
APP-31925: Strict JSON parsing enforced with code compatibility version 15.5
Starting with B2C Commerce Script API (code compatibility) version 15.5, strict parsing is enforced. Previously, versions of the JSON parsers in B2C Commerce accepted invalid JSON that contained extraneous commas before closing brackets.
APP-32088: ECMAScript compliance issue in B2C Commerce script parser fixed with compatibility version 15.5
When compatibility version 15.5 is selected, an error is thrown when code accesses undeclared properties, which is proper ECMAScript behavior. For compatibility reasons, this behavior is still allowed if you select a compatibility version earlier than 15.5.
## 13.6
APP-18307: SeekableIterator in Pipeline Dictionary
In B2C Commerce script files, call API methods that return a `dw.util.SeekableIterator` instance. A `SeekableIterator` iterates over its elements a single time. However, if you put this iterator into the Pipeline Dictionary and your API compatibility mode is earlier than 13.6, the iterator can be used multiple times. Depending on the number of elements the iterator represents, this approach can cause memory usage issues.
As of API compatibility mode 13.6, the elements in the `SeekableIterator` can only be accessed one time. If you’re using an API compatibility mode that pre-dates 13.6, there are entries in the API log indicating that the SeekableIterator is being placed into the Pipeline Dictionary. These log entries enable you to identify uses of SeekableIterator where moving to 13.6 compatibility mode can cause a change in your Pipeline behavior.
The log entries take the following form:
```
PipelineDictionary usage violation:
WARN: dw.util.SeekableIterator put in dictionary.
KEY: key_name, SCRIPT: script_name
```
where `key_name` is the pipeline dictionary key, and `script_name` is the name of the script that is putting the `SeekableIterator` into the dictionary.
## 10.6
APP-46080: `SeekableIterator.close()` now ensures that the iterator is closed
As of Release 17.2, `SeekableIterator.close() n`ow ensures that the iterator is closed. Previously in some situations, it was possible to read elements from a `dw.util.SeekableIterator` even after close was explicitly called.
Customer impact: for compatibility modes 10.6 and greater, the iterator must always be empty after a call to `close()`.
APP-15882: API Behavior Change When Accessing SeekableIteratot via the Pipeline Dictionary
Instances of `SeekableIterator` are returned in the API whenever a method returns mass data. Starting with API version 10.6, these iterators can only be iterated one time to avoid possible memory problems for large iterators. Putting them into the pipeline dictionary and trying to loop them multiple times is no longer possible because this approach would require buffering the iterated elements internally.
Previously, and for all customers still running API version 10.4 (compatibility mode), `SeekableIterator` instances stored in the pipeline dictionary could be iterated multiple times (for example, by several loop nodes).
Customer Impact: Check your code for instances of SeekableIterator and adjust as required.
Product Attributes Set At Site Level (No Release Note)
With Compatibility Mode 10.6, the product attributes `onlineFlag`, `searchableFlag`, `searchPlacement`, and `searchRank` are set at the site level. Previously they were set at global level.
APP-15381: Improved ProductAttributeModel Methods GetValue() and GetDisplayValue()
The `getValue()` and `getDisplayValue()` `ProductAttributeModel` methods now return a `MediaFile` instance if there’s a custom image attribute, or a MarkupText instance if there’s a custom HTML attribute. Previously, both methods returned the image path or the HTML source as a simple String.
**note:** Compatibility mode 10.6 must be activated for your code version to take advantage of this functionality.
APP-12148: Inventory levels are now adjusted on order cancellation and order Replacement
For instances configured (via API versioning) to use the B2C Commerce API version 10.6 or later, inventory levels are now adjusted to reflect items from canceled or replaced orders. Previously, when an order was canceled or replaced, no change was made to inventory levels.
Example 1: If an order has 5 units of product X, when the order is canceled, the availability of product X increases by five units.
Example 2: Assume the following:
- Order A has two units of X and three units of Y.
- Order B has three units of X, one unit of Y, and five units of Z.
If order A is replaced by order B, then the number of units available changes: -1 units of X, +2 units of Y, and -5 units of Z
When replacing order A with order B, the inventory levels now reflect that the items in order A are available.
## 10.4
This behavior is the original behavior. You have this version or greater.
**See Also**
**Parent topic:**[Code Deployment](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/site-development/b2c-code-deployment.md)
# Component Differences with PWA Kit
PWA Kit components are typically JavaScript + PropTypes with Chakra primitives and style props. Storefront Next components are TypeScript-first and generally composed from Radix/shadcn patterns with utility-class styling and CVA-based variants. The main shift is from runtime styling and theme objects to compile-time class composition and typed component contracts.
## Component Architecture
| Aspect | PWA Kit | Storefront Next |
| ----------------- | ---------------------- | -------------------------- |
| Language | JavaScript + PropTypes | TypeScript |
| Type Checking | Runtime (PropTypes) | Compile-time (TypeScript) |
| Component Library | Chakra UI (runtime) | shadcn/ui (copied source) |
| Styling Approach | CSS-in-JS (Emotion) | Utility classes (Tailwind) |
| Variant System | Theme config | Class Variance Authority |
| Primitives | Chakra components | Radix UI headless |
## Styling Comparison
| Aspect | PWA Kit (Chakra) | Storefront Next (Tailwind) |
| ---------------- | --------------------------------------- | --------------------------------------- |
| Inline styles | `` | `` |
| Responsive | `display={{base: 'none', lg: 'block'}}` | `className="hidden lg:block"` |
| Hover states | `_hover={{bg: 'blue.600'}}` | `className="hover:bg-blue-600"` |
| Theme tokens | `color="gray.500"` | `className="text-gray-500"` |
| Component styles | `useMultiStyleConfig('Button')` | `buttonVariants({ variant, size })` |
| Style override | Props spread: `{...styles.container}` | Class merge: `cn(baseClass, className)` |
## Responsive Design Patterns
PWA Kit:
```jsx
// Object syntax for breakpoints
// Array syntax (base, sm, md, lg, xl)
// Hook-based
const [isDesktop] = useMediaQuery('(min-width: 992px)')
```
Storefront Next:
```tsx
// Breakpoint prefixes (mobile-first)
// Responsive grid
// JavaScript detection
const isDesktop = typeof window !== 'undefined' &&
window.matchMedia('(min-width: 1024px)').matches;
```
## Component Variants
PWA Kit (Theme-based):
```jsx
// In theme/components/button.js
export default {
baseStyle: {...},
variants: {
solid: {...},
outline: {...},
},
sizes: {
sm: {...},
md: {...},
}
}
// Usage
Click
```
Storefront Next (CVA):
```tsx
// In component file
const buttonVariants = cva("base-classes", {
variants: {
variant: { solid: "...", outline: "..." },
size: { sm: "...", md: "..." },
},
});
// Usage
Click
;
```
## Key Similarities
- Composition over inheritance: Both use functional components composed from primitives
- Props passthrough: Both spread `...rest` props to underlying elements
- Responsive-first: Both prioritize mobile-first responsive design
- Variant systems: Both support component variants for consistent styling
- Accessibility: Both build on accessible component foundations (Chakra/Radix)
- HOC patterns: Both use HOCs for cross-cutting concerns (auth, suspense)
## Conversion Considerations
Here are some tips for moving from Chakra to Tailwind.
- Style props vs. Utility classes: Convert `padding="4"` to `className="p-4"`.
- Theme tokens vs. Tailwind config: Map color/spacing scales.
- useMultiStyleConfig vs. CVA: Convert component style objects to variant functions.
- Responsive objects vs. breakpoint prefixes: Replace `{{base: 'x', lg: 'y'}}` with `"x lg:y"`.
## Component Library Conversion
| Chakra Component | Storefront Next Equivalent | Notes |
| ---------------------------- | ---------------------------------------------------- | ------------------------------------------------------------------- |
| _Layout Primitives_ | | |
| `Box` | `
` with Tailwind | Use `className="..."` for styling |
| `Flex` | `
` | Add `flex-row`, `flex-col`, `gap-*` as needed |
| `HStack` | `
` | Horizontal stack |
| `VStack` | `
` | Vertical stack |
| `Stack` | `
` | Use `flex-row` or `flex-col` |
| `StackDivider` | `
` (ui/separator) | Or use `divide-y`/`divide-x` classes |
| `Center` | `` | |
| `Container` | `
` | |
| `Grid` | `
` | Add `grid-cols-*`, `gap-*` |
| `GridItem` | `
` | Use `col-span-*`, `row-span-*` |
| `SimpleGrid` | `
` | |
| `Wrap` | `
` | |
| `WrapItem` | `
` | Direct child of flex-wrap |
| `Spacer` | `
` | Or use `gap-*` on parent |
| `AspectRatio` | `
` (ui/aspect-ratio) | Radix-based |
| `Divider` | `` (ui/separator) | Radix-based |
| **Typography** | | |
| `Text` | ``, `` with Tailwind | Use `text-*`, `font-*` classes |
| `Heading` | `