Set Global Variable
Create or update a global variable

Set Global Variable Dialog
Parameters
GlobalVariableSource
GlobalVariablePersisted
Variable Name
Text required
Enter the name of the variable you would like to create or modify
Variable Name
must be entered in camelCase
(the first letter must be lowercase)Source
Select required
Default:
Global
Select the source type for the global variable
Global
- Fetch any general global variable (non user variables)User (redeemer)
- Fetch a user global for the current user who activated the actionUser (target)
- Fetch a user global for thetargetUser
- Used in conjunction with the Get User Info for Target sub-action
Value
Text required
Enter the value to assign to the global variable, depends on the selected Source
type, detailed above
Argument
- Enter the name of an existing argument to assign its value to the global variableValue
- Enter any valueIncrement
- Enter anyint
Decrement
- Enter anyint
Variables
Name | Type | Description |
---|---|---|
No data |
C# Usage
Set the value for a global variable
public void SetGlobalVar(string varName, object value, bool persisted = true)
varNamestring required valueobject required persistedbool
using System;
public class CPHInline
{
public bool Execute()
{
string value = "This is saved to a global variable";
//Examples on usage
//Save to a persisted global variable called "myString"
CPH.SetGlobalVar("myString", value, true);
//Save to a non-persisted global variable called "myString"
CPH.SetGlobalVar("myString", value, false);
return true;
}
}