Define and set a user-defined variable.
- name = var_name
Allowed data type: expression or string.
var_namespecifies the name of a user-defined variable. The rules for naming user-defined variables are:
- The identifier must start with a letter (a-z, A-Z).
- Any following character can be a letter, number, or underscore.
- User-defined variables are case-sensitive.
- value = var_value
var_valuespecifies a value to be stored in the variable. It can be any value.
- scope = "session"|"request"|"page"
sessionvariables are available across multiple requests within a session.
requestvariables are available for the current internal Salesforce B2C Commerce request. The
requestvariable isn't available for multiple requests, so it isn't available after an interaction continue node.
pagevariables are available for the current ISML page.
The default scope is the session.
pdictvariable is deprecated. Instead, use the
pdictvariable isn't available for multiple requests, so it isn't available after an interaction continue node.
In B2C Commerce, every user-defined variable is of a specific scope, which defines the visibility and lifetime of the variable. B2C Commerce distinguishes between user-defined variables of the request, pdict, session and page scope.
Scope session means that the variable is accessible to all templates during a particular storefront session. The lifetime of a session variable ends with a session. A session variable can be used in expressions
The first occurrence of
<isset> in a template declares and sets the variable, there is no other special tag needed for declaration. If the variable already exists,
<isset> resets it to the specified value.
If no scope is set when setting the variable, the scope is set to session.
This example shows how
<isset> is used to define and initialize the variable color. The value of color is the string #A0CC99.
If a variable was already defined by a former
<isset> tag (first line), a second
<isset> resets the value of the variable (second line).
In this example
<isloop> is used to get products from the Pipeline Dictionary.
This example shows how
<isset> assigns the value of LoopProduct to Product.
You can also manipulate a value, as shown here:
You can print the value with
Example 1: Accessing the Page Scope
In this example,
isset sets the decorator template to
pt_empty if the
pdict format attribute is set to ajax and to the
pt_account template if it's not. The DecoratorTemplate variable that is set is accessed by