Get Global Variable
Fetch the value of a global variable and populate a local argument

Get Global Variable Dialog
You can quickly access persisted globals without this sub-action by wrapping the name with
~
~myGlobalVariable~
Parameters
GlobalVariableSource
GlobalVariablePersisted
Variable Name
Text required
Enter the name of the variable you would like to fetch
Variable Name
must be entered in camelCase
(the first letter must be lowercase)Destination Variable
Text required
Enter the name of the local argument you would like to populate
It is recommended to use a different name than the global variable name
Default Value
Text
Optionally set a default value
This will create the global variable if it does not exist and then set it to the given value
Variables
Name | Type | Description |
---|---|---|
The variable name and type will be depend on the parameters you selected |
C# Usage
Fetch a global variable by name
public T GetGlobalVar<T>(string varName, bool persisted = true)
varNamestring required persistedbool
using System;
public class CPHInline
{
public bool Execute()
{
//Examples on usage
//Get integer number from persisted global variable
int myInt = CPH.GetGlobalVar<int>("myInt");
//Get string/text from persisted global variable
string myString = CPH.GetGlobalVar<string>("myString",true);
//Get string/text from non-persisted global variable
string myString = CPH.GetGlobalVar<string>("myString",false);
return true;
}
}