Workflow API Overview

As described in the overview, the Custom WorkFlow API is used in scripts to allow users to create their own user workflows in Pyramid. The following provides a high level overview of the API's structure and its core functions.

Note: this feature is available with an Enterprise license only.

Global Entry Point

The API object, 'workflowApi', contains objects, functionality and attributes for building your Workflow.

Main Function

When you start writing logic, you need to start with the empty Main function. The Main function triggers before the screen is loaded. You should use the Main function to implement your logic and register for necessary events with the help of the API object.

Register Events

The first thing to add is the registration of relevant events in the API. The functions you register will be triggered when the relevant event occurs. The 'Workflow' API object contains these key events:

  • onFormLoad - This event triggers when the screen is loaded. You should initialize and populate the screen's HTML elements and your services in this event.
  • onBeforeUnload - This event triggers before the screen is unloaded. You should dispose elements and services in this event before the screen is closed. You may also want to save the user progress before the screen is closed.
  • onSave - This event triggers after a workflow's object was saved. You can save your own objects that are unrelated to the Workflow API so they will stay synchronize with the API's object. This includes communicating with external APIs.

Populate and integrate with the current Thread

The HTML form will be used to expose details from the current thread and its entries. You can find the Thread object in the main API object, "workflowAPI".

The object type is ThreadData and you can access it using this code snippet:


Use the thread object to add, remove and edit Entries.


Each thread is always a single instance - the current session for the workflow. Entries represent the different saved payloads of the thread. Ina conversation, they may be each comment made by a different user. So each thread contains a list of entries. To create a new entry use the current thread object:


Each entry has a 'content' attribute type of JSON, so you can set whatever you want as the payload and use the Workflow API infrastructure for saving your own custom data.

Integrate with Pyramid users and roles

Building a workflow usually requires you to integrate with users and roles.

Use the functionality in the "Utilities" object to get all the users and roles that are accessible to current user


For example, use 'GetUserAndRoles' for getting all of the roles and users.

Using REST calls for saving and loading custom data

You may want to save the payloads to use your own application, services and databases. For that you probably should communicate o a RESTful web service the JavaScript for setting and retrieving data. Because the Workflow API is pure JavaScript, you can use any JavaScript infrastructure and libraries needed for making REST calls.

We suggest that you use the Workflow API object, 'workflowAPI' and its events to house those REST calls.

  • Register 'OnFormLoad' event and retrieve the data that you need for your form from your web service.
  • Register 'OnSave' for saving your data through your web service.