Factorial · Arazzo Workflow

Factorial Amend Contract

Version 1.0.0

Find an existing contract version and update it, otherwise create a new one.

1 workflow 1 source API 1 provider
View Spec View on GitHub Human ResourcesHRISEmployee ManagementTime TrackingPayrollTime OffPerformance ManagementArazzoWorkflows

Provider

factorial

Workflows

amend-contract
Update the latest contract version or create one if none exists.
Lists contract versions, branches on existence, and updates or creates a contract version.
3 steps inputs: contract outputs: createdContractVersionId, updatedContractVersionId
1
findContract
listContractVersions
List contract versions and branch on whether any exist. Updates the most recent when found, otherwise creates a new one.
2
updateContract
updateContractVersion
Update the most recent contract version with the supplied changes.
3
createContract
createContractVersion
Create a new contract version when no existing version was found.

Source API Descriptions

Arazzo Workflow Specification

factorial-amend-contract-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Factorial Amend Contract
  summary: Find an existing contract version and update it, otherwise create a new one.
  description: >-
    A find-then-act flow for contracts. The workflow lists contract versions,
    branches on whether any exist, and then either updates the most recent
    contract version with the supplied changes or creates a brand new contract
    version when none exists. This is the building block for promotion, salary
    change, and contract renewal integrations. 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: factorialApi
  url: ../openapi/factorial-openapi.yml
  type: openapi
workflows:
- workflowId: amend-contract
  summary: Update the latest contract version or create one if none exists.
  description: >-
    Lists contract versions, branches on existence, and updates or creates a
    contract version.
  inputs:
    type: object
    required:
    - contract
    properties:
      contract:
        type: object
        description: >-
          The contract version body (effective dates, working hours, salary,
          contract type) as accepted by Factorial.
  steps:
  - stepId: findContract
    description: >-
      List contract versions and branch on whether any exist. Updates the most
      recent when found, otherwise creates a new one.
    operationId: listContractVersions
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      contractVersionId: $response.body#/data/0/id
    onSuccess:
    - name: contractExists
      type: goto
      stepId: updateContract
      criteria:
      - context: $response.body
        condition: $.data.length > 0
        type: jsonpath
    - name: contractMissing
      type: goto
      stepId: createContract
      criteria:
      - context: $response.body
        condition: $.data.length == 0
        type: jsonpath
  - stepId: updateContract
    description: >-
      Update the most recent contract version with the supplied changes.
    operationId: updateContractVersion
    parameters:
    - name: id
      in: path
      value: $steps.findContract.outputs.contractVersionId
    requestBody:
      contentType: application/json
      payload:
        contract: $inputs.contract
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      contractVersionId: $steps.findContract.outputs.contractVersionId
    onSuccess:
    - name: done
      type: end
  - stepId: createContract
    description: >-
      Create a new contract version when no existing version was found.
    operationId: createContractVersion
    requestBody:
      contentType: application/json
      payload:
        contract: $inputs.contract
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      contractVersionId: $response.body#/id
  outputs:
    updatedContractVersionId: $steps.updateContract.outputs.contractVersionId
    createdContractVersionId: $steps.createContract.outputs.contractVersionId