GhaylStackDocumentationv1.0.2
العربيةWebsite
Platform modules

Platform modules

Approval workflows and delegation

Create versioned approval paths, submit requests and make decisions with dated delegated authority.

Prepare the approval participants

Workflows owns approval definitions, definition versions, requests, decisions, delegations and attachment links. Routes begin with /api/v1/workflows. Before building a path, create the relevant organizational unit and grant participants the permissions and unit scope their roles need.

The four workflow permissions are ManageDefinitions, Request, Approve and Delegate, under Permissions.Workflows. Possessing one does not imply the others. An approver also has to match the current step assignment and satisfy the active-user and unit checks.

Define and activate a path

Send a definition to POST /api/v1/workflows/definitions. Its contract includes familyId, unitId, name, preventSelfApproval and steps. Each step has a name, an assigneeKind and a target ID. Assignment kinds supported by the access resolver are User, Unit and Role.

Create a two-step development path, for example a named supervisor followed by an approval role. Use real IDs from the active tenant. Activate the saved version through POST /api/v1/workflows/definitions/activate. Requests refer to a version ID, so the definition attached to a request can be inspected alongside its history.

Create, submit and decide

Create the request with POST /api/v1/workflows/requests, supplying its version ID and subject. Optional sourceType and sourceId identify the business record that your application associates with it. They do not implement that business process for you.

The action endpoint is POST /api/v1/workflows/requests/act. It accepts the request id, expectedRevision, action, optional comment and optional delegationId.

Action Caller and result
Submit Owner submits a Draft or Returned request; processing starts at step zero
Approve Eligible current approver advances the step; final approval produces Approved
Return Eligible approver returns the request to its owner
Reject Eligible approver rejects the pending request
Cancel Owner cancels a Draft, Returned or Pending request

Read the request again after each action and use its latest revision. A stale revision conflicts with the current state; do not automatically overwrite another person's decision.

Delegate for a defined period

Create delegation through POST /api/v1/workflows/delegations with unit, delegate, permission, start and end. The resolver uses active grants where StartsAt <= now and EndsAt > now, excluding revoked grants. The grantor must still be eligible for the step and hold approval and delegation scope.

preventSelfApproval applies to the requester and to delegated authority derived from that requester. The history records actor, grantor and delegation IDs, so a delegated decision remains attributable. Revoke a delegation using /api/v1/workflows/delegations/revoke when coverage ends early.

Verify and troubleshoot

Test direct approval, delegated approval within its window, expiry and revocation. Confirm that an unrelated user cannot open or decide the request. Read /tasks for actionable work and /requests for the caller's requests.

If a task is missing, check active user and unit status, action scope, current assignment and self-approval rules. If an attachment is rejected, check the Workflows file policy and current edit rights. Creating a ticket after approval is an application integration decision; the workflow contract's source fields alone do not create one.

Implementation references

View MarkdownBack to top

Search documentation

Use ↑ ↓ to move, Enter to open and Esc to close.