Functions in Workflows

You can use functions to interact with, change, and control your data in Okta Workflows.

API Connector

Function

Description

API Endpoint Invoke a flow by specifying a URL.
Authenticate with API Connector cards Use API Connector (HTTP) function cards to make authenticated basic, OAuth 2, or custom connections to third-party services.
Close For use with API Endpoint flows only. See API Endpoint.

This function sends a response back to the caller and closes the HTTP connection, similar to Return or Return Raw, but also allows the flow to continue execution afterward.

This is useful for flows that might not complete before the connection times out, as the caller might call the endpoint again with the same inputs and cause duplicate executions.

Delete Performs an HTTP DELETE request, returning the result of this request and the response headers. On input, takes a required URL input and optional header, body, and query inputs.
Get Performs an HTTP GET request, returning the result of this request and the response headers. On input, takes a required URL input and optional auth, header, and query inputs. Each optional input can either be modeled by a single object-typed input, or by multiple keys with the appropriate group attribute. On output, returns an object with two keys, headers and output. The output key contains the response body, and the headers key contains the response header. More detailed information can be accessed about these by using multiple keys with the appropriate grouping.
HTTP Errors An error in an HTTP function typically corresponds to a standard HTTP error code returned by the API that you called. For instance, if the api returns the status code 400, you get a "Bad Request" error. If the status code is 401, the error is "Unauthorized." For a full list of possible status codes, see HTTP status codes.

Paginate

Use a helper flow to paginate through multiple pages of an HTTP response.

Paginate: set a maximum page index

Set how many times the Paginate function card iterates.

Paginate: API endpoint

Use the Paginate function card against an API endpoint.

Post Performs an HTTP POST request, returning the result of this request and the response headers. On input, takes a required URL input and optional auth, header, body, and query inputs. Each optional input can either be modeled by a single object-typed input, or by multiple keys with the appropriate group attribute. On output, returns an object with two keys, headers and output. The output key contains the response body, and the headers key contains the response header. More detailed information can be accessed about these by using multiple keys with the appropriate grouping.
Put Performs an HTTP PUT request, returning the result of this request and the response headers. On input, takes a required URL input and optional auth, header, body, and query inputs. Each optional input can either be modeled by a single object-typed input, or by multiple keys with the appropriate group attribute. On output, returns an object with two keys, headers and output. The output key contains the response body, and the headers key contains the response header. More detailed information can be accessed about these by using multiple keys with the appropriate grouping.
Raw Request

Advanced. This method performs a raw HTTP request, allowing the flow builder to control all aspects of the HTTP request. This allows a flow to call an XML service for example, or call an HTML service, or various other advanced use cases. While the other HTTP functions are optimized for ease-of-use with typical JSON-based services, the Raw Request function is more flexible, at the cost of being a bit harder to use.

Branching

Function

Description

Assign If Assign a value based on the true or false result of a conditional statement. If there are more than two potential output values, see Lookup.
Continue If Continue or halt the flow based on the result of a true or false conditional test. Use Return Error If instead if you want to halt the flow with an error when the condition is true.
If/Else Use an If/Else conditional statement to determine the steps that the flow should follow.
If/ElseIf Specify different actions to run based on multiple if and else if conditions (similar to Switch or Case in some programming languages). To specify different actions based on a single condition, you can use If/Else instead.
Lookup Convert one value to another using a lookup table. For example, change one web service code to another web service code, or a department name to a contact email.

Control

Function

Description

To Number Convert a string to a numerical value.
To String Convert a numerical value to a string.

Date & Time

Function

Description

Add

Add a multiple of a unit of time (for example, seconds) from a starting date and time and return a new date value.

Convert

Convert a date and time to various formats.

Date to Text

Convert a date and time into a provided format in a specified timezone.

Difference Calculate the difference in time between two dates.
Epoch

Convert a date and time to the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT) not counting leap seconds.

ISO

Calculate the corresponding ISO8601 string using UTC Z notation for a given date and time (not adjusted for local time zone).

Now

Calculate the current date and time in various formats, all in UTC time (not adjusted for local timezone).

Subtract

Subtract a multiple of a unit of time (for example, seconds) from a starting date and time and return a new date value.

Text to Date

Create a date and time from the contents of a text string, according to a specified format.

UNIX

Convert a date and time to the UNIX standard format.

Encryption

Function

Description

AES Encrypt text using AES algorithm and returns the encrypted text.

Decrypt

Decrypt text from a base64 encoding using a key and specified algorithm.

Encrypt Encrypt text into a base64 encoding using a key and specified algorithm.
Hash Hash input text and return a message digest as output with hex, binary, or base64 encoding.
HMAC HMAC hashes input text and returns the resulting hashed text.

MD5

Hash input text using the MD5 hash function, return the resulting hashed text.

SHA1 Hash input text using the SHA-1 hash function, return the resulting hashed text.
SHA256 Hash input text using the SHA-256 hash function, return the resulting hashed text.

Sign

Sign and hash input text with an input algorithm and a private key, and return a message digest as output with hex, binary, or base64 encoding.

Error Handling

Function

Description

If Error

Specify alternate actions to handle an error without stopping your flow.

Return Error Return an error and end the flow.
Return Error If Return an error and halt the flow if a conditional test is true. If you want to conditionally stop a flow but under normal circumstances so it doesn't appear as an error, use Continue If instead.

File

Function

Description

Download

Download a file to the Workflows file system over HTTP or HTTPS.

Use the Download function card in a flow

Use the Download function card to download any file, such as an image or document file, that you can access through a URL in your browser.

Info

Retrieve information about a file. To use the Info function card, set the input to the File Contents of a file downloaded previously in the flow. The output provides basic information about the file.

Multipart Upload

Upload a file from the Workflows file system to a web service, using HTTP or HTTPS, and using multipart form-data.

Upload

Upload a file from the Workflows file system to a web service, using HTTP or HTTPS.

Use the Upload function card in a flow

Use the Upload function card to upload any file, such as an image or document file, from the Workflows file system.

Flow Control

Function

Description

AssignCreate output fields based on the input supplied.

Call Flow

Run another flow within the context of your current flow. Your flow resumes when the other flow finishes. If you don't care about waiting for the other flow to finish, you can use Call Flow Async instead.

Call Flow AsyncStart another flow then continue without waiting for that flow to finish. String together multiple Call Flow Async cards if you want to kick off different sets of actions to run at the same time (in parallel).

Pause

The Pause function currently only works when used in flows that are resumed programmatically. If you want to pause a flow for a specific delay or until a specific time, use a Wait For or Wait Until function.

Pause Raw

Pause the running flow execution, returning raw HTTP data to the caller. Resume it by calling the resume API.

RepeatRuns a helper flow a specified number of times.

Return

End a flow and returns values to the caller of the flow.

Return Raw

Return the data to the caller, with full control over the HTTP Response.

Wait For

Pause the flow and wait for a specified amount of time before resuming the flow execution.

Wait UntilPause the flow and wait until a specific date and time to continue executing the flow.

Flows

Function

Description

Export Flow

Export all the elements of a single flow as a JSON file.

Folders

Function

Description

Export Folder

Export a folder containing one or more flows as a JSON file.

JSON

Function

Description

ParseThis function parses a JSON string into a typed field - such as an object or a list - that you can use in subsequent functions. It's the inverse of the Stringify function.
StringifyThis function converts a typed value - such as an object or a list - into a JSON string. It's the inverse of the Parse function.

JWT

Function

Description

DecodeDecode a JWT without verifying the signature.
SignEncode and sign a JWT.
VerifyDecode and verify a JWT.

List

Function

Description

Add to End

Add an item to the end of a list (also known as Push).

Add to Front

Add an item to the start of a list (also known as Unshift).
At

Return an item at the specified position in a list, where the first item is in position 0.

CollapseCollapse a list of objects into a single object by merging each object in the order that they appear in the list. If objects have overlapping keys, subsequent values take precedence over preceding values.

Combine All

Combine the contents of two or more lists.

ConstructConstruct a new list from a set of values.
Difference

Create a list of items from one list that don't appear in another list.

FilterFilter a list to include only those items that meet a specified condition. (To filter based on more complex criteria, use Filter Custom.
Filter Custom

Given a list, the Filter Custom function creates a list that contains only those items in the list that pass a test. The test is done by calling a helper flow once for each item (see Parent flows and other flow types). The flow returns true or false, as to whether that item should be included in the output list. (To filter using a simple comparison test, use the Filter function instead.)

FindFind the first item in a list that meets a specified condition. To find based on more complex criteria, use Find Custom.
Find Custom

Find an item in a list by running a helper flow on the items, one at a time, and returning the first item where the flow returns True. For simple searches, use the Find function instead.)

Flatten

Take a list that contains multiple lists and convert it into a single list.

For EachProcess a list by calling a helper flow for each item.

For Each - Ignore Errors

Process a list by calling a helper flow for each item. This function is almost identical to the For Each function, with one important difference. For Each stops processing more items if an error occurs when processing one of the items in the helper flow. On the other hand, this function continues to process all items even if some hit errors in the helper flow.
Get First ItemGiven a list, return two outputs: the first item and the list with that item removed (aka Shift).
Get Last ItemGiven a list, return two outputs: the last item and the list with that item removed (aka Pop).

Group By

Read a list and extract a list, grouped by the values in the original list at the specified path.

IncludesCheck whether a list contains a particular item. The output is a True/False value - it returns true if the list contains the item, false if it doesn't. The list can be a list of any type of item; for example, a list of text, a list of numbers a list of objects. The value must be an item of that type.
Index ByThis function is designed for a common API pattern, where a service returns a list of field values as a list of objects that each contain a field name as one key, and a field value as another key.
IntersectionGiven two or more input lists, creates a list that contains only those items that are included in all of the input lists. The lists can be of any type, as long as all lists are set to the same item type.
LengthFind the number of items in a list.
List to TextThis function generates a single text output from a list, using an optional separator. For instance if you have a list of product names, you can use this function to create a comma-separated list of products to include in an email.
Map

The Map function converts a list to a new list. This is achieved by running a helper flow for each item in the list. See Parent flows and other flow types.

MergeMerge objects from two or more lists at matching offsets. If an item with the same key exists in multiple lists for the same offset, the value from the later list overwrites the value from an earlier list.
Pluck

This function takes a list of objects, and produces a sublist. It does that by plucking the key specified by key from each object in the input list, and putting those values into an output list. The list input must be a list of objects.

ReduceThis function produces a single cumulative value by running a helper flow for each item in a list. For example, you can determine the largest number in a list of numbers, or count how many text items start with "A" in a list of text strings. The result can be any type, so you can also use Reduce to build a text string, date, boolean, object, or a list of any of those.
Remove DuplicatesRemove duplicates from a list.
ReverseReverse the order of the items in a list.
SampleGenerate a random sample from a list.
SliceChoose a subset of a list using start and end points.
SortSort a list from smallest to largest.
Sort CustomSort Custom allows you to do a custom sort on a list by calling another flow to generate the value used to sort each item. For simple sorts, use the Sort function instead.

Split

Split a list at a specific index value.

Statistics

Read the statistics for a list of numbers.

SumCalculate the sum of a list of numbers. This function accepts only a list of type number. If your numbers are formatted as a list of text, you can use the Map function to convert each item from text to a number. If your numbers are stored inside a list of objects, you can use the Pluck function to generate the list of numbers you need to pass into Sum.

Swap

Swap two elements in a list.

TruncateCut a list down to a specified length.
Union (Combine Unique)Combine multiple lists into a single list of all the unique values contained in any of the input lists. The lists can be of any type as long as all lists are set to the same type, including the output list.
Unique CustomUse custom logic to determine how to remove duplicates from a list.
XORTake two input lists and generate a new list that contains all the items that are in one or the other input list but not both.
ZipTake two lists of equal length and combine them into a list of lists of each corresponding pair.

Number

Function

Description

Absolute Value

Calculate the absolute value of a number. The absolute value is the size of the number regardless of its negative or positive state.

Add

Return the sum of two or more input values. This card accepts two input values by default, but you can add more values.

Divide

Return the quotient from the division of two values.

Exponent

Calculate Euler's number, e (approximately 2.718), raised to a specified power, or exponent.

Factorial

Calculate the factorial of a number, returning 0 if that number is less than 0. A factorial is the product of an integer and all the non-zero or non-negative integers less than it.

Formula

Build a math expression by combining operators, functions, and numbers that you enter with fields that you drag and drop into the Formula card. You can place fields of the type Number anywhere in the expression where there can be a number. At runtime, the expression is evaluated using the values of the fields to generate a single output number.

Increment

Increase a numerical value by one.

Larger

Return a Boolean value indicating whether a value is larger than another.

LogCalculate a logarithm, which is the power to which a base number must be raised to produce a given number.
Multiply

Calculate the product of two or more values.

Percentage

Read and format the percentage of a value to a specified number of decimal places.

PowerCalculate a base number raised to a specified power, or exponent.
Random Integer

Generate a random integer between two numbers.

Remainder

Find the remainder after the division of one number by another.

Round

Round a number to the nearest integer.

Round Decimal Places

Round a numerical value to a specified number of decimal places.

Round Down

Round down to the nearest integer.

Round Up

Round up to the nearest integer.

Sign

Return the sign of a number.

Smaller

Return a Boolean value indicating whether a value is smaller than another.

Square Root

Calculate the square root of a number.

Subtract

Return the difference between two values.

Object

Function

Description

Clear EmptyRemoves keys with no values associated (for example, null, "", {}) from an object. Similar to the Object - Filter function but with the added ability of choosing whether the filtering is recursive.

Collapse

Combine a list of objects with key and value properties into a single JSON object. This is the inverse of the Split function card.

ConstructCreates an object based on a set of user-defined inputs.
FilterThe Filter card removes keys with no values associated (for example, null, "", {}) from an object. If the object may contain other objects, use the Clear Empty card instead.
For EachIterates through an object key-by-key using a helper flow. For each key in the input object, the helper flow is called with the key name and value for that key. You can select those with the dropdown after selecting a helper flow using the Choose Flow button.
GetReads the value stored in an object at a given path. For example, if the object is: { "a":"one", "b":"two", "c": 17 } then specifying a path of b returns the text string two. To get more than one value at a time from an object, use Get Multiple instead.
Get MultiplePicks several values from an object at once. Similar to Get, the Get Multiple card allows you to access values within an object by providing multiple keys and/or paths to values in an object.
KeysThe Keys card generates a list of the keys within your object.
MapProcesses an object key-by-key using a helper flow, creating an object as output. For each key in the input object, the helper flow is called with the key name and value for that key. You can select those with the dropdown after selecting a helper flow using the Choose Flow button.
Map to ListIterates through an object key-by-key using a helper flow, creating a list as output, with one item in the list per key in the object. For each key in the input object, the helper flow is called with the key name and value for that key. You can select those with the dropdown after selecting a helper flow using the Choose Flow button.
MergeMerges multiple objects into a single object. The output object has all the keys (with their associated values) that appear in any of the input objects. If the same key appears in more than one of the input objects, only one value is taken. There are two inputs by default, but more can be added.
MoveMoves a value from one key to another key, which essentially renames the key while keeping the value the same.
SetSets a key of an object to a specified value, creating a key if it doesn't exist already.
SizeReturns the number of elements in an object.

Split

Split an object into a list of objects, each with key and value properties. This is the inverse of the Collapse function card.

UnsetDeletes a key/value pair from an object.

Unzip

Convert an object to two lists, one with keys and the other with values.

ValuesThe Values card generates a list of the values within your object.
ZipCreate an object from two lists, by mapping keys from the first lists to values from the second. This is useful when creating an object that has keys with dots in the key names.

Tables

Function

Description

Clear Table

Delete all rows in a table.

Create RowCreate a row in a table.
Delete RowDelete a row in a table.
Export to CSV

Export a table to a CSV file, including all rows or a filtered subset of rows.

Import From CSVImport the contents of a CSV file into a Table.
Read RowRead the values from a row in a table.
Read TableReturn the column schema of a table, as identified by the table ID.
Search RowsFind rows in a table that match a set of conditions.
Update RowUpdate a row in a table.

Text

Function

Description

AtReturn the single character at a specified position in a text input, where 0 is the first position. To get a whole segment rather than a single character, use the Text Segment function. To search for a single character, use Find.
Base64

Return the base64 encoding of a string.

Base64 Decode

Return text that is decoded from base64.

ComposeCombines any text that you type and any fields you drag and drop in. At runtime, the text is combined with the values of the fields to generate a single text output.
Concatenate

Take two or more string inputs and combine them without spaces into a single text output.

Find EmailFind and return the first instance of a valid email address in a text string.
Find

Find the first instance of a string within another string.

Find LastSearch for the last match inside a text string, where 0 is the first position. The function card returns -1 if no match is found.
Find Pattern

Search text for the first match to a specified pattern using regular expressions.

Length

Calculate the number of characters in a string of text.

Random

Return random text of a specified length.

ReplaceSearch and replace text.
Replace PatternsFind and replace any matched multiple patterns with a single value. For any find and replace that looks for a single text or pattern, use Replace.
SplitSplit text into a list of text segments separated by commas or another specified delimiter.
Text SegmentExtract text from a string value.
To Lower Case

Convert all letters in a string to lowercase.

To Upper Case

Convert all letters in a string to uppercase.

Trim

Remove leading and trailing blank space from text.

Unique ID

Generate a random universally unique identifier (UUID), sometimes called a globally unique identified (GUID). The identifier consists of 32 hexadecimal (base 16) digits, displayed in five groups and separated by hyphens.

True/False

Function

Description

All False?Return true if all inputs are false. Otherwise, it returns false. (Also known as the Boolean operator NOR.)
AndReturn true if all inputs are true. Otherwise, it returns false.
Any False?Return true if any of the inputs are false. Otherwise, it returns false (also known as NAND).
CompareRun a simple true or false test. For instance, you might check to see if a Type field is equal to "Customer" or if a Price field is greater than 1000.
ExpressionBuild a True or False expression by combining operators and values that you type with fields that you drag and drop in. Place fields anywhere in the expression where there can be a value. At runtime, the expression is evaluated using the values of the fields to generate a single output of true or false. When using non-True/False inputs, number fields evaluate to false when 0; otherwise true. Text fields evaluate to false when null or "false". Otherwise, it returns true. Date fields convert to a timestamp that works in comparisons.
NotTakes a true or false input and returns the opposite value.
OrReturn true if any inputs are true, otherwise false.
Or (Exclusive)The Exclusive Or true/false operator (also known as XOR) returns true if one, and only one, input is true. Otherwise, it returns false.
XNORA True/False operator that returns true if both inputs are true or both inputs are false. Otherwise, it returns false. This is the opposite of the Exclusive Or (or XOR) operation.

URL

Function

Description

Decode ComponentDecode a URL-encoded component such as the value of a query parameter. This function card decodes all URL-encoded characters and outputs the decoded text.
Decode Query

Decode a URL-encoded query string into a query object.

Encode ComponentEncode text into a URL-encoded text for use within a URL.
Encode QueryEncode a query object into a URL-encoded query object.
FormatConstruct a URL string from its components.
ParseParse a URL string into its components with proper encoding.

XML

Function

Description

BuildConvert an object to an XML string.
ParseThis function converts an XML string to an object. By converting the XML string to an object, you can use many of the built-in functions (such as those in the List and Object categories) to process and use values from the XML string in the rest of your flow.