You are here:
Omnistudio Invocation Functions
Functions that invoke or are related to invoking other functions and operations.
- Omnistudio COUNTQUERY Function
Executes a SOQL query and returns the number of matching rows. - Omnistudio FUNCTION Function
Executes a custom function defined as a method of an Apex class. - Omnistudio GENERATEGLOBALKEY Function
Generates a global key for use as an Id in a data pack. - Omnistudio QUERY Function
Executes a SOQL query and returns a JSON list of results. - Omnistudio GLOBALAUTONUMBER Function
Generates a unique number as per the configurations you define through the Omni Global Auto Number page.
Omnistudio COUNTQUERY Function
Executes a SOQL query and returns the number of matching rows.
Pass a single SOQL query to the function. The query can retrieve data from only a single column (a single field).
Signature
COUNTQUERY(query)
Return Value
Integer
Parameters
Parameter |
Data Type |
Necessity |
Description |
|---|---|---|---|
|
SOQL Query |
Required |
A string that contains a valid SOQL query. In the |
Sample Account object data from database:
{
"Account Name": "Acme Shipping",
"Account Number": "CD451796",
"Billing State": "GA",
"Billing Zip": 27215
},
{
"Account Name": "GenePoint",
"Account Number": "CC978213",
"Billing State": "CA",
"Billing Zip": 94043
},
{
"Account Name": "Edge Communications",
"Account Number": "CD451796",
"Billing State": "TX",
"Billing Zip": 78767
},
{
"Account Name": "Express Logistics",
"Account Number": "CD736025",
"Billing State": "MO",
"Billing Zip": 63101
},
{
"Account Name": "Pyramid Construction",
"Account Number": "CD112262",
"Billing State": "CA",
"Billing Zip": 94087
}
Sample data:
"InputStateWest": "CA",
"InputStateEast": "PA"
Formula: COUNTQUERY("SELECT Name FROM Account WHERE BillingState = 'CA'")
Formula: QUERY("SELECT Name FROM Account WHERE BillingState LIKE '{0}'", %InputStateWest%)
Return value: 2
Formula: QUERY("SELECT Name FROM Account WHERE BillingState = 'PA'")
Formula: QUERY("SELECT Name FROM Account WHERE BillingState LIKE '{0}'", %InputStateEast%)
Return value: 0
Omnistudio FUNCTION Function
Executes a custom function defined as a method of an Apex class.
See Sample Apex Code for Custom Functions for an Apex class that defines the custom functions shown in the examples.
Signature
FUNCTION(class, method, input...)
Return Value
Any data type
Parameters
Parameter |
Data Type |
Necessity |
Description |
|---|---|---|---|
|
String |
Required |
The name of the Apex class that defines the custom function to be called. The class
must define the named |
|
String |
Required |
The name of the Apex method that defines the custom function to be called. The method must
be defined in the named |
|
Any date type |
Required |
A comma-separated list of one or more values to be passed as input to the custom function.
To pass a list or a JSON array as an input value, use the |
Sample data:
"InputList": [
"abc",
"def",
"ghi"
],
"ListKey": "Item"
Formula: FUNCTION('MyCustomFunctions', 'convert', LIST(%InputList%), %ListKey%)
Formula: FUNCTION('MyCustomFunctions', 'convert', LIST(InputList), ListKey)
Formula: FUNCTION('MyCustomFunctions', 'convert', LIST("abc", "def", "ghi"), 'Item')
Return value:
[
{
"Item": "abc"
},
{
"Item": "def"
},
{
"Item": "ghi"
}
]
Sample data:
"InputString": "my-input-string",
"ToReplace": "-",
"ReplaceWith": "_"
Formula: FUNCTION('MyCustomFunctions', 'replace', %InputString%, %ToReplace%, %ReplaceWith%)
Formula: FUNCTION('MyCustomFunctions', 'replace', InputString, ToReplace, ReplaceWith)
Formula: FUNCTION('MyCustomFunctions', 'replace', "my-input-string", "-", "_")
Return value: "my_input_string"
Sample data: "Phone": 1234567890
Formula: FUNCTION('MyCustomFunctions', 'formatPhoneNumber', %Phone%)
Formula: FUNCTION('MyCustomFunctions', 'formatPhoneNumber', Phone)
Formula: FUNCTION('MyCustomFunctions', 'formatPhoneNumber', 1234567890)
Formula: FUNCTION('MyCustomFunctions', 'formatPhoneNumber', "1234567890")
Return value: "(123) 456-7890"
Omnistudio GENERATEGLOBALKEY Function
Generates a global key for use as an Id in a data pack.
Signature
GENERATEGLOBALKEY(prefix)
Return Value
String
Parameters
Parameter |
Data Type |
Necessity |
Description |
|---|---|---|---|
|
String |
Optional |
A string to be prepended to the global key that the function returns. The function
inserts a |
Formula: GENERATEGLOBALKEY()
Return value: "15c4ec2d-be7a-4f54-b342-652fdf159f30"
Formula: GENERATEGLOBALKEY("SUB")
Return value: "SUB-f72bd2ca-a03b-48e3-af30-485efb4fa4d9"
Omnistudio QUERY Function
Executes a SOQL query and returns a JSON list of results.
Pass a single SOQL query to the function. The query can retrieve data from only a single column (a single field).
To get the size of the JSON list that's returned, first use the ISBLANK
function to test for an empty list. If the list is not empty, use the LISTSIZE
function to return its size. Call the functions in separate Set Values actions or Data Mapper
functions. (The COUNTQUERY function returns the number of matching rows from
a query.)
Signature
QUERY(query)
Return Value
JSON list
Parameters
Parameter |
Data Type |
Necessity |
Description |
|---|---|---|---|
|
SOQL Query |
Required |
A string that contains a valid SOQL query. In the |
Sample Account object data from database:
{
"Account Name": "Acme Shipping",
"Account Number": "CD451796",
"Billing State": "GA",
"Billing Zip": 27215
},
{
"Account Name": "GenePoint",
"Account Number": "CC978213",
"Billing State": "CA",
"Billing Zip": 94043
},
{
"Account Name": "Edge Communications",
"Account Number": "CD451796",
"Billing State": "TX",
"Billing Zip": 78767
},
{
"Account Name": "Express Logistics",
"Account Number": "CD736025",
"Billing State": "MO",
"Billing Zip": 63101
},
{
"Account Name": "Pyramid Construction",
"Account Number": "CD112262",
"Billing State": "CA",
"Billing Zip": 94087
}
Sample data:
"InputStateWest": "CA",
"InputStateEast": "PA"
Formula: QUERY("SELECT Name FROM Account WHERE BillingState = 'CA'")
Formula: QUERY("SELECT Name FROM Account WHERE BillingState LIKE '{0}'", %InputStateWest%)
Return value: [ "GenePoint", "Pyramid Construction" ]
Formula: LISTSIZE(QueryResult)
Return value: 2
Formula: QUERY("SELECT Name FROM Account WHERE BillingState = 'PA'")
Formula: QUERY("SELECT Name FROM Account WHERE BillingState LIKE '{0}'", %InputStateEast%)
Return value: {}
Formula: LISTSIZE(QueryResult)
Return value: 1
Formula: IF(ISBLANK(QueryResult), 0, LISTSIZE(QueryResult))
Return value: 0
Formula:
IF(COUNTQUERY("SELECT Name FROM Account WHERE BillingState = 'CA'"),
LIST(QUERY("SELECT Name FROM Account WHERE BillingState = 'CA'")),
0)
Return value: [ "GenePoint", "Pyramid Construction" ]
Formula:
IF(COUNTQUERY("SELECT Name FROM Account WHERE BillingState = 'PA'"),
LIST(QUERY("SELECT Name FROM Account WHERE BillingState = 'PA'")),
0)
Return value: 0
Omnistudio GLOBALAUTONUMBER Function
Generates a unique number as per the configurations you define through the Omni Global Auto Number page.
For more information on defining your own numbering system, see Set Up Omni Global Auto Numbers.
Signature
GLOBALAUTONUMBER("GlobalAutoNumber"),
GLOBALAUTONUMBER("Name")
Return Value
String
Parameters
Parameter |
Data Type |
Necessity |
Description |
|---|---|---|---|
|
String |
Optional |
A global auto number name, which you created on the Omni Global Auto Number page. When
you call this function without any value as an input, the value
|
Formula: GLOBALAUTONUMBER()
Return value: "OS-12345"
Formula: GLOBALAUTONUMBER("Loan Application Number")
Return value: "LI-6298525"

