Run Workflows Builder Toolbox

Start instance and complete a step (script)

To automate workflows by creating workflow instances and completing steps within those instances, use the Python script below. Use case: You can create a new onboarding workflow instance, automatically complete the first step (such as filling in the personal details), and move the workflow forward in Next Matter.

  1. The script creates an instance with process_id and tags. The name is created automatically as per Next Matter settings.
  2. Fills the step with the required input data and marks a step in the workflow as completed.
    • Uses the API endpoint: https://core.nextmatter.com/api/instances//complete_step/
    • Requires:
      • Instance ID (to specify the workflow instance)
      • Step ID (which step to complete)
      • List of form fields ( with input data required for the step to complete) If successful, shows a completion message.

Filter instances by max total runtime

You can use this API call to get filtered instances of a workflow. In the example below, we’re filtering for all instances with a maximum total runtime of 50 seconds.

https://core.nextmatter.com/api/processes/WORKFLOW_ID/instances/?total_runtime_max=00:50

Here are some other examples of values to use:

  • 01 09:30 - 1 day and 9 minutes and 30 seconds
  • 02:30:00 - 2 hours and 30 minutes (and 0 seconds)
  • PT50M - 50 minutes (as per ISO 8601 duration formats)
  • PT1H30S - 1 hour and 30 seconds (as per ISO 8601 duration formats)