arazzo: 1.0.1 info: title: Oracle Integration Start a Process and Handle Its Task summary: Start a structured process instance, locate the user task it generates, and act on that task. description: >- The end-to-end happy path for a structured process. The workflow confirms the process definition exists, creates a new process instance with an input payload, lists the user tasks to find the one belonging to the new instance, retrieves that task, and performs an action such as APPROVE on it. Every step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: processApi url: ../openapi/oracle-integration-process-automation-api.yaml type: openapi workflows: - workflowId: start-process-and-handle-task summary: Create a process instance and act on the first task assigned to the current user. description: >- Verifies the process definition, creates an instance, lists tasks, retrieves the first task, and performs the supplied action on it. inputs: type: object required: - processDefId - title properties: processDefId: type: string description: The process definition identifier (e.g. default~OrderApproval~1.0). serviceName: type: string description: The service name that starts the process. default: OrderApprovalService title: type: string description: Title for the new process instance. payload: type: object description: Input payload for the process instance. default: {} action: type: string description: The action to perform on the resulting task (e.g. APPROVE, REJECT). default: APPROVE actionComment: type: string description: Comment recorded with the task action. default: Handled by automated workflow. steps: - stepId: getDefinition description: >- Retrieve metadata for the process definition to confirm it exists before starting an instance. operationId: getProcessMetadata parameters: - name: processDefId in: path value: $inputs.processDefId successCriteria: - condition: $statusCode == 200 outputs: processDefId: $response.body#/processDefId - stepId: createInstance description: >- Create a new process instance from the definition with the supplied title and input payload. operationId: createProcessInstance requestBody: contentType: application/json payload: processDefId: $inputs.processDefId serviceName: $inputs.serviceName title: $inputs.title payload: $inputs.payload successCriteria: - condition: $statusCode == 201 outputs: processId: $response.body#/processId state: $response.body#/state - stepId: listTasks description: >- List user tasks so the task generated by the new process instance can be located. operationId: listTasks parameters: - name: limit in: query value: 25 - name: offset in: query value: 0 successCriteria: - condition: $statusCode == 200 outputs: firstTaskId: $response.body#/items/0/id onSuccess: - name: hasTask type: goto stepId: getTask criteria: - context: $response.body condition: $.items.length > 0 type: jsonpath - name: noTask type: end criteria: - context: $response.body condition: $.items.length == 0 type: jsonpath - stepId: getTask description: >- Retrieve the first task to confirm it is ASSIGNED before acting on it. operationId: getTask parameters: - name: id in: path value: $steps.listTasks.outputs.firstTaskId successCriteria: - condition: $statusCode == 200 outputs: taskState: $response.body#/state taskTitle: $response.body#/title - stepId: performAction description: >- Perform the supplied action on the task, recording an accompanying comment. operationId: performTaskAction parameters: - name: id in: path value: $steps.listTasks.outputs.firstTaskId requestBody: contentType: application/json payload: action: $inputs.action comment: $inputs.actionComment successCriteria: - condition: $statusCode == 200 outputs: finalState: $response.body#/state outcome: $response.body#/outcome outputs: processId: $steps.createInstance.outputs.processId taskId: $steps.listTasks.outputs.firstTaskId finalState: $steps.performAction.outputs.finalState