workflow

Implements and debugs role-based state transitions for OrangeHRM approval workflows.

1.1k|746|Updated Jan 5, 2017
One-click install
npx skills add https://github.com/orangehrm/orangehrm --skill workflow-orangehrm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workflow
Source: https://github.com/orangehrm/orangehrm/tree/main/.agents/skills/workflow
Command: npx skills add https://github.com/orangehrm/orangehrm --skill workflow-orangehrm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the complexity of implementing and debugging role-based approval flows in OrangeHRM, where tracking allowed state transitions, role-specific permissions, and post-transition side effects across leave, claims, recruitment, and other business processes requires deep, fragmented knowledge of the underlying state machine.

Core Features & Use Cases

  • Generic State Machine Reference: Documents the ohrm_workflow_state_machine table that powers all approval-style flows, including workflow type constants, per-flow action constants, and state string conventions.
  • Service API Guidance: Covers AccessFlowStateMachineService methods to query allowed actions, compute next states, retrieve actionable states for approval queues, and look up full workflow rows for notification routing.
  • Implementation & Debugging Support: Includes standard transition flow patterns, two-layer authorization rules, migration seeding examples, and checklists for adding new transitions or resolving "user can't take action" issues. For example, use this Skill to diagnose why a Supervisor cannot approve a leave request by checking for missing workflow rows, data-group permission gaps, or state string mismatches.

Quick Start

Use the workflow skill to look up the allowed actions for a Supervisor role on a leave request in 'PENDING APPROVAL' state to determine which UI buttons to display for the user.

Frequently Asked Questions about workflow

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

FAQPage Schema
How do I add new state transitions to an OrangeHRM approval workflow?

Add new state transitions by inserting rows into the ohrm_workflow_state_machine table with the correct workflow type constants, action constants, and state strings. The skill provides migration seeding patterns to properly populate the database.

Why can't a Supervisor approve a leave request in OrangeHRM?

A Supervisor cannot approve a leave request due to missing workflow rows, data-group permission gaps, or state string mismatches. Use the provided debugging checklists to verify role-specific action permissions and resolve the issue.

How does the AccessFlowStateMachineService API work in OrangeHRM?

The AccessFlowStateMachineService API queries allowed actions, computes next states, retrieves actionable states for approval queues, and looks up full workflow rows for notification routing across all OrangeHRM business processes.

How do I query actionable states for an approval queue in OrangeHRM?

Query actionable states for an approval queue by using AccessFlowStateMachineService methods to retrieve allowed actions for a specific role and state combination. This determines which UI buttons to display for the user.

How do I wire event dispatching for post-transition side effects in OrangeHRM workflows?

Wire event dispatching for post-transition side effects by using the service API to look up full workflow rows after computing state transitions. This enables notification routing and other automated actions following successful approval flows.

What are the two-layer authorization rules for OrangeHRM workflow state transitions?

Two-layer authorization rules in OrangeHRM workflows require validating both the ohrm_workflow_state_machine rows for role-specific action permissions and the data-group permissions. Both layers must pass for a user to execute a state transition.