workflow

Documents OrangeHRM's generic workflow state machine for modeling role-based approval transitions.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone --skill workflow-snow-gift111
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workflow
Source: https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone/tree/main/.agents/skills/workflow
Command: npx skills add https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone --skill workflow-snow-gift111

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? OrangeHRM drives all approval-style flows (leave, claim, recruitment, timesheet, review) through a single generic state machine table, and this Skill explains how to query, extend, and debug those (workflow, state, role, action) → resultingState transitions without reverse-engineering the schema. ## Core Features & Use Cases - State machine reference: Documents the WorkflowStateMachine entity, the eight FLOW_* constants, per-flow action constants, and the string-typed storage semantics of ohrm_workflow_state_machine. - Service API guidance: Covers AccessFlowStateMachineService methods like getAllowedActions, getNextState, and getActionableStates for permission checks, transitions, and approval queues. - Recipes and checklists: Provides patterns for executing transitions (compute next state, persist, dispatch event), seeding rows via migrations, and debugging why a role cannot take an action. - Use Case: When adding a new leave-approval transition, follow the checklist to add the action constant, seed the workflow row via migration, wire the domain service, and dispatch the notification event. ## Quick Start Ask the AI to explain how to add a new approval transition to the leave workflow using the workflow skill.

Frequently Asked Questions about workflow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if a user role can perform a workflow action in OrangeHRM?

Use AccessFlowStateMachineService::getAllowedActions with the workflow constant, current state string, and role name. It returns the allowed action IDs as strings, or null when no workflow rows match that combination.

How do I add a new transition to an existing OrangeHRM workflow?

Add or reuse an action constant on the WorkflowStateMachine entity, seed the (workflow, state, role, action, resulting_state) row via a migration, then wire the domain service to compute the next state, persist the entity, and dispatch an event.

Why can't a user approve a leave request even with update permission?

OrangeHRM layers workflow transitions on top of data-group permissions. Even with can_update permission, there must be a matching row in ohrm_workflow_state_machine for that exact state, role, and action, otherwise getNextState returns null.

Why does getNextState return null in the OrangeHRM workflow service?

A null return means the transition is not allowed for that workflow, state, role, and action combination. Common causes are missing seed rows, misspelled state or role strings, or comparing integer action IDs against their string-typed database values.

When should I use the workflow state machine versus a simple status field?

Use the state machine when multiple roles take different actions from the same state or transitions must be configurable and auditable. For simple two-state toggles or single-role resources, a plain status column on the entity is sufficient.