Overview
The "Set Variable" panel creates new variables or updates existing ones within your Logic+ flow. Each panel can define one or more variable entries, and values can be set to a static string (Simple) or computed from an expression using built-in functions (Expression), such as math, string manipulation, JSON path extraction, or date operations. Variables defined here can be referenced downstream as $(variableName) to drive routing decisions, build dynamic prompts, pass data to integrations, and track information across the flow.
Using this panel
Many panels accept variables in their configuration, allowing for dynamic output that changes based on what values are contained in those variables. Use the Set Variable panel to adjust variables as needed for your use case(s). This panel creates individual entries for each variable created or updated.
Properties
-
Name
Enter a unique, descriptive name to identify the panel.
-
Description
Enter any notes about the panel for reference. This field is collapsed by default; select the down arrow to expand it.
-
Initiates Flow
Designates this panel as the starting point of the Logic flow. When selected, this panel will be the first to execute when the flow is triggered. This can only be removed by setting a different panel as the flow initiator.
-
Redact Data in Logging
Disables data logging for this panel to support data redaction requirements. This feature is available upon request and is subject to change.
Fields
-
Variable Name
The variable name should be clear and concise to enhance understanding of its purpose. For example, I have set the ANI as callerID for an easy-to-understand reference later in the flow. When referencing a variable set outside this panel, one can use the callerID example as $(callerID) or refer to it as $(yourVariableNameHere).
-
Value Type
Simple: The Simple value type updates the specified variable to a new string value.
Expression: You can also use an Expression value type to manipulate the values of existing fields.
Function(s)
Math
-
Subtract:
Takes two numbers and subtracts the second number from the first. Accepts two or more operands. Example: 10 - 3 = 7.
-
Add:
Adds two or more numbers together. Example: 5 + 2 = 7.
-
Multiply:
Multiplies two numbers. Example: 4 * 3 = 12.
-
Divide:
Divides the first number by the second. Example: 12 / 4 = 3.
-
Round:
Rounds a number to the nearest whole number. Example: 3.5 becomes 4.
-
Absolute Value:
Returns the positive value of a number, regardless of whether it is negative. Example: |-5| = 5.
String
-
Append:
Concatenates two strings, joining the second string to the end of the first. Example: Appending "World" to "Hello" gives "Hello World"
-
Slice:
Extracts a portion of a string using a range expression. Example: slicing "0:3" from "hello" returns "hel" (the first three characters). A negative value such as "-2" returns the last two characters.
-
Length:
Returns the number of characters in a string. Example: The length of "hello" is 5.
-
Replace:
Replaces the first occurrence of a substring within a string with another substring. Example: Replacing "dog" with "cat" in "doghouse doghouse" gives "cathouse doghouse"
-
Replace All
Replaces every occurrence of a substring within a string with another substring. Example: Replacing "." with "-" in "a.b.c" gives "a-b-c"
-
Regex Replace:
Uses a regular expression to find the first matching pattern in a string and replace it. Example: Replacing the pattern \d (any digit) with "X" in "a1b2" gives "aXb2"
-
Regex Replace All:
Uses a regular expression to find all matching patterns in a string and replace them. Example: Replacing the pattern \d in "a1b2c3" with "X" gives "aXbXcX"
Data
-
JSON Path:
Allows querying and extracting specific values from a JSON object using a path expression. Example: $.store.book[0].title would get the title of the first book in a store.
-
Random Number:
Generates a random whole number within a specified minimum and maximum range. Example: a range of 1 to 100 returns a value somewhere in that range.
Date
All date operations work on ISO 8601 timestamps (e.g. 2026-06-16T10:31:52.396-04:00). The current time is available as the system variable $(DATE.NOW).
-
Create Date:
Builds a date value from individual parts (year, month, day, hour, minute, second, millisecond). Example: building a date from "2026", "06", "05", "12", "00", "00", "000" produces a value representing June 5, 2026 at noon.
-
Set Date Value:
Modifies a single part of an existing date and returns the updated date. Example: setting the year of an existing date to "2027".
-
Set All Date Values:
Modifies multiple parts of an existing date in a single step. Provide values for the parts you want to change and leave the others empty to keep their original values.
-
Get Date Value:
Extracts a single part of a date as a value. Example: Getting the year from a date returns "2026"
-
Date Difference:
Returns the difference between two dates expressed in seconds. Example: Comparing a date one minute apart from another returns 60.
-
Date Format:
Formats a date as a string using a format pattern. Example: formatting a date with "yyyy-MM-dd" produces "2026-06-05". Format patterns follow standard date-time tokens (yyyy = year, MM = month, dd = day, HH = hour, mm = minute, and ss = second).
Useful date examples:
Goal (Function - Date Format) |
Date |
Format String |
Returns |
|---|---|---|---|
Unix timestamp (seconds) |
|
X |
|
Unix timestamp (ms) |
|
x |
|
ISO date only |
|
|
|
24-hour time |
|
|
|
Human-readable |
|
|
|
US-style date |
|
|
|
Exits
The Default path is taken upon panel execution.
Additional Information
There is a 10,000-character limit on the value of variables set in Logic+.
To return data to Classic Logic, dotCX, and action bots, you can use the Set Variable Panel and a variable naming convention of 'SharpenCX_ClassicLogic_<varName>'. The Classic Logic flow will have access to a call variable named <varName>.
Related Articles
This article is part of a series on Admin Configuration topics.