Repository navigation
ADR 004
Proposed
The MaestroTaskProcessTemplate is a reusable UiPath Studio project designed to serve as a task implementation pattern within UiPath Maestro BPMN workflows. These processes must return structured execution output—most importantly the status object defined by status-schema.v1.json:contentReference[oaicite:0]{index=0}.
Traditional templates like REFramework use state machines and queue items. However, MaestroTaskProcessTemplate is intentionally designed to be procedural and API-like, emphasizing:
- Structured inputs and outputs (JSON schemas)
- Synchronous execution as BPMN task elements
- Clear separation between internal business logic and external Maestro contract formatting
This ADR addresses how we manage status and errors throughout the linear execution flow.
We adopt the following layered and Go-inspired strategy for error handling and status output:
The MainEntrypoint.xaml follows a linear flow:
InitializeValidateProcessingTeardown
No state machines or implicit transaction logic is used.
- A global variable
GlobalVariables.errholds a customErrorContextobject. - This context is initialized in
Initialize, optionally populated by the Global Exception Handler, and updated in user code on demand. - This replaces the need for scattered error-related variables (
errorType,errorMessage, etc.).
- The internal variable
stat : Statusrepresents the current execution state. - It is initialized using
StatusBuilder.Create(...)inInitialize. - It is mutated, not reassigned, throughout the workflow.
- It follows the structure defined in
status-schema.v1.json.
- In
Teardown, the existingstatobject is updated based on the globalErrorContextusing:StatusAdapter.UpdateFromError(stat, err)-
StatusAdapter.MarkSuccess(stat)(if no error)
- The final object is converted to
JObjectusingStatusAdapter.ToJObject(stat) - The output argument
Status : JObjectreceives this result.
This pattern separates logic-layer mutation from contract-layer serialization, treating StatusAdapter as a formal adapter from Status → JObject.
A standard Studio Global Exception Handler:contentReference[oaicite:1]{index=1} is used to populate the GlobalVariables.err context when unhandled exceptions occur. This allows a unified mechanism to record retryable/non-retryable errors while maintaining forward-only, sequence-driven flow.
| Design Objective | How This Approach Satisfies It |
|---|---|
| Simplicity | Procedural sequences are easier to debug and extend |
| API contract compliance | Status output fully conforms to status-schema.v1.json
|
| Traceability | Centralized error state supports detailed reporting |
| Layered architecture | Builders, models, adapters, and utils are clearly separated |
| Future extensibility | Can support retry strategies, payload introspection, or enriched tracing |
- Developers working within the template only need to interact with:
req : Requeststat : Statuserr : ErrorContext
- No need to manage dictionary assignments or create output manually.
- Error flow and status response logic is fully testable and encapsulated.
-
status-schema.v1.json:contentReference[oaicite:2]{index=2} Status.csErrorContext.csStatusBuilder.csStatusAdapter.cs- [
Global Exception Handler]
Christian Prior-Mamulyan cprior@gmail.com
Note
Help to improve this documentation. Submit feedback.
Copyright © 2025 Christian Prior-Mamulyan · License CC BY-SA 4.0