Global Workflow Functions
On this page
A global workflow function is the one unit of workflow that can be invoked from outside the product, and the REST API is what invokes it. The function runs with no anchor object and must belong to the Global Workflow object. How a function is authored, and how its parameters are declared, is covered in Functions.
In the API
Run AI processing
To run AI processing through the API, call the Ask AI system global workflow function in a separate request. For the AI Control limitation, see Actions that use AI Control.
Call a global function
POST <api>/V1/function/{functionId} runs a global function, where <api>
is the base address of the REST API; the route adds no api segment of its
own after it. The id may be the
function's GUID or its number. Either way, it is resolved only among global
functions, so a function scoped to a class is not reachable this way. An id
that matches nothing is answered with "'id' is not a valid Global
Function ID."
The body is a flat JSON object whose keys are the function's parameter names, exactly as declared. The accepted scalar value types are string, integer, float, boolean, and null; any other scalar shape is rejected as an invalid request body. An array value carries attachments, as described below. A key that names no parameter of the function stops the call with "Parameter 'name' is unknown." A parameter you do not mention is treated as not supplied, so its declared default applies. A value for a reference-typed parameter is resolved against that parameter's lookup before the run starts.
To pass attachments, supply a JSON array under the name of an
attachment-type parameter. Each element carries FileName (required),
Description, Data (the content), IsLink, Size, and, in the public
API, AttachmentArea. An element with IsLink together with non-empty Data
is rejected by name. An array for a non-attachment parameter, or a plain
value for an attachment parameter, stops the call with "Parameter 'name'
accepts only type type values." An action call selects a form's
attachment area; a global-function call selects the parameter instead.
A parameter of the Script Object type is neither refused nor defaulted. The text you post becomes the parameter's value for this call, so its declared default no longer applies, but the parameter's script object is not set from it: the parameter's placeholder in the function evaluates to an empty value.
The function runs through the ordinary workflow engine, with API as its
initiator.
Read the result
The response object carries Succeed and a list of messages. Messages that
the function would display are collected in this list. A workflow abort
sets Succeed to false and returns normally; any other exception returns
an error. If Succeed is false and the list contains at least one message,
the envelope also reports failure and uses the last message as its error
text. A caller that reads only the envelope therefore receives the
function's failure message.
What a global function call does not do
A global function runs with no object context. The run is not a stored workflow item: it exists only while the function runs, and a log entry written for it names no workflow item. How logs are read is covered in Logs.
The technician-portal assistant reaches workflow by proposing and running actions on an object, not by calling global functions.
Related topics
- Functions - authoring global and class-scoped workflow functions and their parameters.