Best Practices for Process Folders
  • 29 Jun 2023
  • 2 Minutes to read
  • Dark
    Light

Best Practices for Process Folders

  • Dark
    Light

Article Summary

Process Folders and Flow Execution Extensions are powerful for building robust applications. However, when working with long-running processes, it's important to consider certain aspects during development. This article presents best practices for initial process folder creation, handling errors, and managing future upgrades to ensure smooth execution and maintain data integrity.

By following these best practices, developers can ensure efficient development and maintenance of long-running processes in Decisions. Carefully managing initial process folder creation, error handling, and future upgrades enhances modularity, reduces the risk of errors, and supports a smooth user experience.


Initial Process Folder Creation

To enhance modularity and flexibility, separate the initial data input from the creation of the process folder. This allows different ways to start the main process, such as calling an API endpoint. 

Be cautious when using end forms between the initial submission and process folder creation, as they change the current user to SYSTEM. 

Ensure that any end forms occur after the process folder is created to maintain accurate submitter information. 

If initializing the Flow execution extension before creating the process folder, remember that the output will contain associated IDs, which may require updating your data object or working with the Extension Data object throughout the Flow.

Building for Errors

Granular error handling is crucial for long-running flows. Instead of relying solely on generic top-level error handling, incorporate assignments into sub-flows, allowing the Flow to return to the start of the subflow in case of an exception. 

Implement error-catching mechanisms that enable rollbacks using the Flow Management dashboard, which provides tools to analyze and modify active flows. 

Avoid patterns like catch exception, log step, and end step, and ensure there is an error assignment to keep the Flow active for rollback purposes.

Remember that a Process Folder and Flow Execution Extension are data that are saved in the database. Even if the main process Flow ends prematurely, build other flows and actions on this data to give users ways to interact with it.

Building for Future Upgrades

When making changes to flows with in-flight data, it's important to understand how Decisions handles versioning. The platform uses the latest version of a Flow, Form, or Rule when executing a step, regardless of when the Flow was started. This means that after importing changes, the Flow will continue with the new version, not the original one. 

Be cautious of potential issues when adding new inputs to sub-flows or introducing new fields to Forms during an active Flow. 

Consider initializing new data between pausable points in the Flow or use Flow Management tools to update in-flight processes with the required data.

Managing Field Changes and Assigned Forms

Upgrading long-running flows can introduce challenges when replacing or removing assigned forms. Removing an assigned Form step can cause errors for in-flight processes currently at that step, preventing the completion and triggering exceptions. To handle field changes and assigned forms effectively, consider the following solutions:

  • Update existing forms whenever possible instead of creating new versions.
  • Keep the existing assignment step in the Flow with connected outputs and route the Flow to the new assignment. Once all in-flight processes have progressed past the deprecated step, remove it from the Flow. This method is suitable for minor Flow changes.
  • Create a new version of the Flow by copying it. Keep the old version as deprecated, allowing in-flight processes to complete while launching new processes with the new Flow version. This approach is applicable for major Flow modifications.

Was this article helpful?