Define an Update a Variable or Stored Value Action

Use the Update a Variable or Stored Value Action to update a variable or Stored Value using a predefined value, or the value of a User-specific variable. When you create User-specific variables, they are available in other Actions within the One-Step™ Action, including pre/post-steps and Expressions. For example, use a One-Step Action to prompt a User for a value (example: Name of a Customer), and then store the selected value as a User-specific variable (rather than in a temporary Field). The variable can be used throughout the One-Step Action to take different Actions depending on which value was selected.

When executing a One-Step Action containing variables, those variables only retain their values while the One-Step Action executes. If the One-Step Action is executed again, the variables have no values until set by this Action. If this window is canceled, all User-defined variables are removed and no longer available for use.

To define an Update a Variable or Stored Value Action for a One-Step Action:

  1. Open the One-Step Editor.
  2. Add an Update a Variable or Stored Value Action to the Designer Board.
  3. Define general properties and the type of value to update for the Update a Variable or Stored Value Action:
    Option Description
    Name Provide a display name for the Action (this is how the Action is identified within the One-Step Action).
    Stored Value Select this radio button to update a Stored Value. Click the Ellipses button to open the Stored Value Manager, and then select an existing Stored Value, or create a new one.

    If you select a Stored Value that contains User-specific values (or if you use this Action to update a Stored Value with a User-specific value), the following warning appears: This Stored Value has a different value for each User. The value set here will only apply to the current User.

    If the User-specific value is not remembered between sessions, you will see the following additional warning: Also, this value will be reset to the default value when the application is restarted.

    Clear Use-specific Values and Restore the Stored Value to Its Default Value Select this check box to remove any values a User has defined specifically for their own use and restore the Stored Value to its default value.

    This option is only available if a Stored Value that contains User-specific values is selected.

    Based on Scope and Value Select this radio button to have the Action make a selection based on a specified scope and Token Value. Then, select the scope in the drop-down. Click the Selector button to open the Token menu and select a Token that holds the appropriate name or ID.
    Variable Select this radio button to define unique variables.
    Variable Provide a name for the variable. This is the name that is shown in the Token tree for other Actions within the One-Step Action.
    Tip: When you provide a variable name, the Variable radio button is automatically selected.
    Data Type Select a Data Type (example: Text, Number, Date/Time, Logical, JSON/JSON Array, XML/XML Collection). If you use XML or JSON data types, the defined value (below) must use the appropriate JSON or XML syntax.
    New Value Value that will update a variable or Stored Value. A value cannot be defined if this Action is used to clear User-specific values and return Stored Values to their default values.

    Provide text. Click the Selector button to insert Tokens (example: Fields, System Functions, Prompts, Expressions, Stored Values, Metrics, and Counters) directly into the text.

    After Replacing Tokens, Evaluate the Result as a Calculation Select this check box to have the value of the variable or Stored Value treated as a simple Expression that returns a calculated result rather than a string.
    Note: This is a powerful feature with almost endless possibilities. For best results, follow the guidelines below.
  4. Define Annotation properties.
  5. Click Save.

Variable or Stored Value Treated as an Expression Guidelines

  • When you create an Expression, use a Token to refer to the values. Tokens are typically selected from the Token tree, but you can also type specific values or Tokens if necessary.
  • Enclose string Tokens and string values with single quotation marks (example: 'Incident.Status' = 'Closed').
  • Any Tokens that contain non-alphanumeric characters, start with a digit, or match any of the following reserved words require special handling:
    • And
    • Between
    • Child
    • False
    • In
    • Is
    • Like
    • Not
    • Null
    • Or
    • Parent
    • True
  • If a Token meets any of the above conditions, it must be enclosed in either square brackets or back quotes. For example, Token# must be written as either:
    • [Token#]:Total * [Token#]
    • `Token#`:Total * `Token#`
  • If a Token enclosed in square brackets contains any square brackets or backslashes within its name, then you must insert a backslash before the brackets or backslashes. If a Token is enclosed in back quotes, then it cannot contain any back quotes within its name. For example, a Token named Token[]\ would be written as either:
    • Total * [Token[\]\\]
    • Total * `Token[]\`
  • You can use User-defined values within Expressions and compare them to Token values.
    • Enclose string values in single quotation marks (example: 'StringToken' = 'John'). If a value includes a single quotation character within its name, then you must insert another single quotation mark before the character.
    • Number Tokens do not need to be enclosed in quotation marks (example: NumberToken <= 50.00). You can use decimals and scientific notation in numeric values.
    • Enclose date values within pound signs (example: #DateToken# < #01/31/82#).
  • You can concatenate Expressions using Boolean AND, OR, and NOT operators.Use parentheses to group clauses and force precedence (the AND operator has precedence over other operators). For example: (‘StringTokenLastName’ = 'Smith' OR ‘StringTokenLastName’ = 'Jones') AND ‘StringTokenFirstName’ = 'John'
  • The following operators are allowed in comparison Expressions:
    • <
    • >
    • <=
    • >=
    • <>
    • =
    • IN
    • LIKE
  • The following arithmetic operators can be used in Expressions:
    • + (addition)
    • - (subtraction)
    • * (multiplication)
    • / (division)
    • % (modulus)
  • The following functions can be used in Expressions:
    Convert
    Description Converts an Expression to a specified .NET Framework type
    Syntax Convert(expression,type)
    Arguments

    expression: The Expression to convert

    type: The .NET Framework type to which the value will be converted.

    Example Convert('StringTokenValue,' 'System.Int32')
    Exceptions
    • Boolean can be converted to and from Byte, SByte, Int16, Int32, Int64, UInt16, UInt64, String, and itself only.
    • Char can converted to and from Int32, UInt32, String, and itself only.
    • DateTime can be converted to and from String and itself only.
    • TimeSpan can be converted to and from String and itself only.
    IIF
    Description Retrieves one of two values depending on the result of a logical calculation.
    Syntax IIF(expr, truepart, falsepart)
    Arguments

    expr: The Expression to evaluate.

    truepart: The value to return if the Expression is true.

    falsepart: The value to return if the Expression is false.

    Example IIF(TotalTokenName>1000, 'expensive', 'dear')
© Copyright 2018 Cherwell Software, LLC. All rights reserved.