1<isset2 name = var_name \\required3 value = var_value \\required4 scope = "session"|"request"|"page" \\required5/>
name = var_name
Allowed data type: expression or string.
var_name specifies 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_value specifies a value to be stored in the variable. It can be any value.
scope = "session"|"request"|"page"
session variables are available across multiple requests within a session.
request variables are available for the current internal Salesforce B2C Commerce request. The request variable isn't available for multiple requests, so it isn't available after an interaction continue node.
page variables are available for the current ISML page.
The default scope is the session.
The pdict variable is deprecated. Instead, use the scope="request" variable. The pdict variable isn't available for multiple requests, so it isn't available after an interaction continue node.
Purpose
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.
Note
Examples: Using Isset to Create a Custom Variable
Example 1
This example shows how <isset> is used to define and initialize the variable color. The value of color is the string #A0CC99.
1<isset name="color" value="${'#A0CC99'}">
Example 2
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, 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 ${DecoratorTemplate}.