Open EPM ← Back to openepm.dev

Define a workflow

Replace the placeholders with values from your own authorized scope before copying this prompt into an MCP client.

Inputs

  • {{workspace_id}} Stable workspace ID.
  • {{application_id}} Stable application ID.
  • {{definition}} Reviewed workflow definition with activities, selection, assignments and evidence.
  • {{request_key}} Stable key for saving the version.
  • {{metadata_revision}} Current integer revision from application.state.read.
  • {{assignment_digest}} Exact published assignment definitionDigest.
  • {{rule_digest}} Exact published rule programDigest.

Prompt

In {{workspace_id}} / {{application_id}}, verify the application state, exact selection, activity dependencies, and assignment version references in {{definition}}.
Use read_v2_program with application.workflow.list to find the workflow's stateRevision and next version. Page until you find the flowId or establish it is new. Only a new workflow starts at state revision 0 and version 1. Read application.state.read for metadataRevision, policyRevision and schemaEpoch.
Call execute_v2_application_workflow with application.workflow.save, definition {{definition}}, expectedStateRevision, expectedMetadataRevision, expectedPolicyRevision and expectedSchemaEpoch, and idempotency_key {{request_key}}.
Read the saved flowId and version with application.workflow.read. Return the Saved status, definitionDigest and save operationId.
Stop before publication or starting an occurrence. Stop earlier if any dependency, revision or assignment binding is invalid.

Example inputs

In the disposable Operating Data Cube, publish the Point A assignment and the Input Uplift rule. Read the exact published versions for their digests. The flow selects the assigned cell, gives the assigned subject an action, and gives the reviewer a dependent review that can return to the action. Both activities use manual attestation. The participants need their own application access. Saving the flow leaves it Saved and creates no occurrence.

{
  "format": "openepm-application-task-flow-v2",
  "workspaceId": "{{workspace_id}}",
  "applicationId": "operating-cube",
  "flowId": "docs.point-a-review",
  "version": 1,
  "name": "Point A input review",
  "selection": {
    "format": "openepm-cube-selection-v1",
    "metadataRevision": {{metadata_revision}},
    "dimensions": [
      {"dimensionId":"Account","include":{"kind":"member","memberId":"InputA"},"exclude":null},
      {"dimensionId":"Entity","include":{"kind":"member","memberId":"PointA"},"exclude":null},
      {"dimensionId":"Year","include":{"kind":"member","memberId":"Y2027"},"exclude":null},
      {"dimensionId":"Period","include":{"kind":"member","memberId":"P01"},"exclude":null},
      {"dimensionId":"View","include":{"kind":"member","memberId":"Input"},"exclude":null},
      {"dimensionId":"Value","include":{"kind":"member","memberId":"Raw"},"exclude":null},
      {"dimensionId":"Scenario","include":{"kind":"member","memberId":"Actual"},"exclude":null},
      {"dimensionId":"DataType","include":{"kind":"member","memberId":"InputData"},"exclude":null},
      {"dimensionId":"Custom01","include":{"kind":"member","memberId":"ItemA"},"exclude":null}
    ]
  },
  "activities": [
    {
      "activityId": "prepare", "name": "Check the input", "kind": "Action",
      "dependsOn": [], "returnTo": null,
      "assignmentRef": {"assignmentSetId":"docs.coordinate-review","version":1,"digest":"{{assignment_digest}}","assignmentId":"point-a-review"},
      "destination": {"kind":"Artifact","artifactKind":"ApplicationRule","artifactId":"docs.input-uplift","version":1,"digest":"{{rule_digest}}"},
      "evidenceContract": {"kind":"ManualAttestation","statement":"I checked the input at the selected coordinate."}
    },
    {
      "activityId": "review", "name": "Review the input check", "kind": "Review",
      "dependsOn": ["prepare"], "returnTo": "prepare",
      "assignmentRef": {"assignmentSetId":"docs.coordinate-review","version":1,"digest":"{{assignment_digest}}","assignmentId":"point-a-review"},
      "destination": {"kind":"Artifact","artifactKind":"ApplicationRule","artifactId":"docs.input-uplift","version":1,"digest":"{{rule_digest}}"},
      "evidenceContract": {"kind":"ManualAttestation","statement":"I reviewed the input check."}
    }
  ]
}

Tools used include read_v2_program, execute_v2_application_workflow. See the module guidelines and tool index.

Discussion

Discussing Define a workflow

The discussion service requires JavaScript and a connection to Firebase.