B2C Commerce script supports data types that allow you to integrate extensive functionality into your scripts.
Attributes that are queryable can be found when using Advanced Search extended attributes when searching for products in Business Manager. Whether or not the data type is queryable in Business Manager doesn't affect whether the attribute is searchable in the storefront.
B2C Commerce supports the data types listed in the following table for B2C Commerce script.
|String||B2C Commerce script top-level String class||Letters, numbers, and punctuation. Use for a word or sentence. Maximum 4000 bytes allowed.||Yes|
|Text||B2C Commerce script top-level String class||Letters, numbers, and punctuation. Use for large amounts of text, such as descriptions.||No|
|Html||B2C Commerce script dw.content.MarkupText class||HTML tags. This type is intended for HTML tags and values. If editing HTML attributes, Business Manager lets you edit them in an HTML editor. Editing in an HTML editor isn't possible for String or Text data types.||No|
|Integer||number||A number without decimal places, such as 1, 2, 3, or 4. Attribute value range is from -2,147,483,648 to 2,147,483,647 (32 bit Signed Integer)||Yes|
|Number||number||Number. You can select the number of places after the decimal point by adding a scale value. If you’re creating a custom attribute for a money value, use the Money data type. The Number data type only uses the values of the decimal in calculations. For example, 1/3 with 2 as the scale is processed as 0.33. If you multiply this number by 3, you see 0.99 rather than 1. In contrast, the Money data type has localized rules for rounding that cause numbers to provide totals as expected for a specific currency.||Yes|
|Boolean||boolean||True or False||Yes|
|Date||B2C Commerce script top-level Date class||MM/dd/yyyy||Yes|
|Date + Time||B2C Commerce script top-level Date class||MM/dd/yyyy : h: mm a||Yes|
|Image||B2C Commerce script dw.content.MediaFile class||An image. Merchants can select the image from the image folder structure. Developers can use a script to dynamically retrieve an image using a pipeline.||No|
|string||Email address. Business Manager requires the merchant to enter a valid syntax for an email address. For example, it requires a valid extension after the @ sign, among other requirements.||Yes|
|Password||string||Password. This type shows a masked field and confirmation field where the merchant can enter a password. Password data type values are encrypted on export and can be encrypted for import.||No|
We provide script timeouts to protect storefronts. For example, if you accidentally create an endless loop, the loop can cause massive thread exhaustion and require a restart of the instance.
The described rules apply fully for compatibility modes 21.2 and later. For older compatibility modes depending on the situation, a defined timeout may not be active.
Scripts in different contexts can have different timeouts (see the following tables). If a script is called from a different context then the resulting timeout is the one that ends earliest. For example, if shortly before the 5-minute timeout of a controller request a page designer script is started, then the page designer script can be aborted before its own 30-second timeout is finished.
|Controller Requests||5 minutes||-|
|OCAPI Requests Hooks||30 seconds||-|
|Script module step||-||Yes, see Steptypes.json Syntax.|
|Page Designer scripts||30 seconds||-|
|Form field validation scripts||30 seconds||-|
|Hooks called from scripts||-||-|
|ISML embedded scripts||-||-|
|Pipeline Contexts (deprecated)||Timeout||Configurable|
|Pipeline assigns node scripts||30 seconds||-|
|Eval pipelet||30 seconds||-|
|Script pipelet||30 seconds within storefront requests and 15 minutes within jobs||Yes, see Pipelet Script.|
If a debug session is open, the minimum timeout for all script contexts is increased to 30 minutes.
In case a script timeout occurs the script is aborted with a non-catchable exception. The exception is logged in the error log. The message text contains something like:
Typically this error leads to an error response (HTTP status 500) or a failed job execution. Note if this happens during template rendering the request might not fail, instead, a partly rendered response might be seen by users, but such responses are never cached longer than 5 minutes.
Pipeline runtime is limited via the Quota “api.pipeline.timeout”. This defines a timeout of 5 minutes for storefront requests, and no timeout during job execution, for example, via the ExecutePipeline Job Step.
The rules for the script timeout always apply and aren’t influenced by the Quota “api.pipeline.timeout”.
The timeout values for
webreference objects are based on the timeout value of the calling script. The script timeout value is used as an upper bound for the timeout that is configured for the
It’s recommended to use the service framework, which has multiple monitoring and management features for web services. Nevertheless, for HTTPClient or SFTPClient, the timeouts can also be set as part of the function call.
To view the default global timeout:
- Select Administration > Global Preferences > Global Timeouts.
If you’re having difficulty with scripts timing out while calling a third-party system or service, you can contact Customer Support to change the timeouts temporarily.
The Script Debugger API is a JSON-based set of requests and responses that are managed using a REST servlet.
This RESTful API enables you to create applications that interact with the Script Debugger for setting breakpoints, viewing variables, and evaluating expressions.
This API isn't available on a Production instance.