Dave Slusher

3 minute read

As we continue our lightning tour of new developer-facing features of the Madrid release, we touch on some that are not net-new but include relevant changes. Today’s post is one of these. The London release featured the first release of Flow Designer APIs that allowed for invoking Flows via JavaScript APIs. That capability has been beefed up in Madrid and we’ll look at that.

Server-Side Flow APIs

The London release had two APIs, startAsync for Flows and SubFlows. In Madrid, this has been increased to a core set of six calls.

  • startAction(String name, Map inputs, Number timeout)
  • startFlow(String name, Map inputs, Number timeout)
  • startSubflow(String name, Map inputs, Number timeout)

All of these are asynchronous calls, the equivalent of the previously available calls but with the addition of being able to call a single Action. All of these require passing a Map object that will contain name-value pairs that would match the inputs that would be passed to that Action, Flow or Subflow in the same context as their execution by the Flow engine. When invoking yourself via script, it is the caller’s responsibility to verify all necessary inputs are provided in your script.

In addition, there is another set:

  • executeAction(String name, Map inputs, Number timeout)
  • executeFlow(String name, Map inputs, Number timeout)
  • executeSubflow(String name, Map inputs, Number timeout)

These APIs are all synchronous and thus must be used with care. This can be valuable in a situation such as an integration where the invoking code may need a return value that will take time. The flip side is that any of these actions can theoretically take a very long time such as when asking for approvals or waiting for a set time. If it takes longer than the timeout limit, this may cause your client code to have execution cut short. Knowing that time of execution ranges will drive your choice of synchronous or asynchronous APIs.

More detail on these APIs is available at the Docs site and the Developer site.

Client-Side GlideFlow APIs

New in Madrid is the concept of client-side execution of server-side flows. It is an interesting notion and one that opens up a lot of logic and functionality.

These would be used on the client-side as GlideFlow. The invocation APIs are analogous the the above:

  • startAction(String scopedName.actionName, Map inputs)
  • startFlow(String scopedName.actionName, Map inputs)
  • startSubflow(String scopedName.actionName, Map inputs)

All of these APIs return an execution object. That object has some APIs:

  • execution.awaitCompletion()
  • execution.getExecutionStatus()
  • execution.getOutputs()

The awaitCompletion() call is a blocking API that will return a completion object, so it can be used to wait on the final output of the server-side execution. As above, it pays to know how long that might take but there will be different timeouts in play.

This could conceivably be used to show some sort of real-time status in a Service Portal widget or other interesting uses.

Again, more detail on these APIs is available at the Docs site and the Developer site.


These APIs seem simple but by exposing this small set of additional calls, the world of available logic is opened up much wider. Whether invoking on the server or in a browser, there are exciting new capabilities that await some creative applications. If you have such a need or put it to an interesting use, give us any details you are permitted to share in the comments.

Thanks for reading, and happy developing!