arazzo: 1.0.1 info: title: Workday Request Time Off With Balance Check summary: Verify a worker has enough time off balance, then submit a time off request and confirm it. description: >- A common absence-management pattern that checks a worker's available time off balances before submitting a new time off request. The workflow reads the worker's dynamic plan balances, branches on whether any balance is available, requests the time off through the Request Time Off business process, and then re-reads the created entry to confirm it was recorded. 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: absenceManagementApi url: ../openapi/workday-tracking-system-absence-management-openapi.yml type: openapi workflows: - workflowId: request-time-off-with-balance-check summary: Check balances, request time off, and confirm the created entry. description: >- Reads time off plan balances for a worker, only proceeds to request time off when a balance exists, then fetches the newly created entry to verify it persisted. inputs: type: object required: - workerId - bearerToken - timeOffType - startDate - endDate properties: workerId: type: string description: The Workday ID of the worker requesting time off. bearerToken: type: string description: OAuth 2.0 JWT bearer token for authenticating with Workday. asOfDate: type: string description: Optional balance as-of date (YYYY-MM-DD). timeOffType: type: string description: Type of time off plan (e.g. Vacation, Sick). startDate: type: string description: Start date of the time off (YYYY-MM-DD). endDate: type: string description: End date of the time off (YYYY-MM-DD). comment: type: string description: Optional comment for the request. steps: - stepId: checkBalances description: >- Read the worker's dynamic time off plan balances so the request is only made when the worker has an available balance. operationId: listTimeOffBalances parameters: - name: Authorization in: header value: Bearer $inputs.bearerToken - name: workerId in: path value: $inputs.workerId - name: asOfDate in: query value: $inputs.asOfDate successCriteria: - condition: $statusCode == 200 outputs: balances: $response.body#/balances onSuccess: - name: hasBalance type: goto stepId: requestTimeOff criteria: - context: $response.body condition: $.balances.length > 0 type: jsonpath - name: noBalance type: end criteria: - context: $response.body condition: $.balances.length == 0 type: jsonpath - stepId: requestTimeOff description: >- Submit a new time off request for the worker via the Request Time Off business process. operationId: requestTimeOff parameters: - name: Authorization in: header value: Bearer $inputs.bearerToken - name: workerId in: path value: $inputs.workerId requestBody: contentType: application/json payload: timeOffType: $inputs.timeOffType startDate: $inputs.startDate endDate: $inputs.endDate comment: $inputs.comment successCriteria: - condition: $statusCode == 201 outputs: timeOffId: $response.body#/id status: $response.body#/status - stepId: confirmTimeOff description: >- Fetch the newly created time off entry to confirm it was recorded and capture its current status. operationId: getTimeOff parameters: - name: Authorization in: header value: Bearer $inputs.bearerToken - name: workerId in: path value: $inputs.workerId - name: timeOffId in: path value: $steps.requestTimeOff.outputs.timeOffId successCriteria: - condition: $statusCode == 200 outputs: confirmedId: $response.body#/id confirmedStatus: $response.body#/status timeOffType: $response.body#/timeOffType outputs: timeOffId: $steps.requestTimeOff.outputs.timeOffId confirmedStatus: $steps.confirmTimeOff.outputs.confirmedStatus