Skip to Content

Handle Arrays Using Get and Set


This page describes how to handle arrays using the Get and Set functions.

Set an Array

You can set an array using this syntax:


This will create an array variable called varname and append value to it. Note that you can use either a string varname or a global variable named varname. The array can be read in a sorted manner by using SortArray.

When to Use Global Variables

There are scenarios where building global variables dynamically is valuable, leveraging the capability of Set to work with a string as the variable name. For example, you can incorporate the data value into the global variable name and use it later in the workflow, such as when using a condition filter. For example:

soql = "Select purchase_order_number__c from PO_c";
arr = Array();
arr = SFLookupAll(<tag>,soql);
i = 0;
While(i < Length(arr),
Set("po_num_" + arr[i],true);

For use with the above example, the condition filter could be defined as follows:

If(Length(Get("po_num_' + <source_po_value>)) > 0, true, false);

It is true that this could also be accomplished with a dictionary. With smaller datasets, global variables and dictionaries are equivalent. But when dealing with larger datasets, performance will be faster using a specific global variable rather than a dictionary.