API access to Flow Designer
Summarize
Summary of API Access to Flow Designer
Application developers can utilize APIs to access Flow Designer functionalities, enabling the triggering of flows, subflows, and actions. Flow designers can make these elements callable during the design phase.
Show less
Key Features
- Available Flow Designer APIs: Trigger flows, subflows, and actions through server or client scripts.
- Server-side FlowAPI: Use synchronous or asynchronous methods to trigger actions or flows, optionally including execution details.
- Client-side GlideFlow: Allows client-side interactions with flows and actions, provided they are enabled for client calls.
- FlowAPI Quick Methods: Execute actions, flows, or subflows quickly from server-side scripts without creating records, enhancing performance in high-volume environments. Key methods include:
- executeActionQuick()
- executeFlowQuick()
- executeSubflowQuick()
- startActionQuick()
- startFlowQuick()
- startSubflowQuick()
- XML and JSON Streaming APIs: Create and send bulk data payloads via REST or SOAP requests using JSONStreamingBuilder and XMLStreamingBuilder.
- Client Callable APIs: Enable individual flows, subflows, or actions for client calls during the design process.
- Run As Support: Flows can be configured to run as the system user or the session initiator, with quick methods defaulting to the system user.
- Code Snippets: Generate JavaScript functions for calling published flows, subflows, or actions in scripts like business rules.
Key Outcomes
By leveraging these APIs, ServiceNow customers can enhance their application development process, streamline interactions with Flow Designer elements, and improve system performance by efficiently managing data processing and API calls.
Application developers can access Flow Designer functionality through APIs for flows, subflows, and actions. Flow designers can enable individual flows, subflows, and actions to be client callable during design.
Available Flow Designer APIs
Trigger flows, subflows, and actions using these APIs from server or client scripts.
- Server side
- FlowAPI: Trigger a flow, subflow, or action using synchronous or asynchronous methods, with or without execution details.
- Client side
- GlideFlow: Perform client-side interactions with actions, flows, and subflows. Flow designers must enable a flow, subflow, and action to be called from the client.
FlowAPI quick methods
Use quick methods in the FlowAPI class to run an action, flow, or subflow from a server-side script without creating execution details or other related records. Use these methods to increase the speed of high-volume processing in a production environment, and to improve performance by eliminating record-keeping overhead. Methods include:
- executeActionQuick(), executeFlowQuick(), executeSubflowQuick(): Run an action, flow, or subflow from a server-side script synchronously from the current user session.
- startActionQuick(), startFlowQuick(), startSubflowQuick(): Run an action, flow, or subflow from a server-side script asynchronously.
XML and JSON streaming APIs
Build a large streaming or non-streaming JSON or XML payload to use in a REST or SOAP request to send bulk data to a third-party API. For example, you can use these APIs to create a JSON payload in the ServiceNow® Flow Designer Script step and pass the returned value to the REST step to send the request to a third-party service. For more information, see JSONStreamingBuilder and XMLStreamingBuilder .
Client callable APIs
By default, the flows, subflows, and actions can only be called by the FlowAPI within a server script. Flow and action designers can make individual flows, subflows, or actions available to client calls by enabling the Client callable option during the design process.
Run as support
Flows and subflows can run as either the system user or the user who initiates the session. Set this behavior from the flow properties. All API quick methods ignore the run as property, and always run as the system user.
Actions always run as the user who initiates the session.
Code snippets
Application developers can generate a JavaScript function that calls a specific flow, subflow, or action with the Code Snippet option. Use the code snippet in scripts such as business rules or the Scripts - Backgound module to call specific Flow Designer elements. The system only generates code snippets for published flows, subflows, and actions. Flow Designer elements in the draft or modified status do not generate code snippets.