Generate approval matrix #205
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Generates a structured approval matrix by traversing a user’s managerial chain for the specified number of levels (e.g., their manager, manager’s manager, etc.).
This avoids hardcoding approval paths — making approvals dynamic and maintainable.
⚙️ Inputs
Name Type Description
user_sys_id String Sys ID of the starting user
levels Integer Number of manager levels to retrieve (e.g., 3 = manager → director → VP)
🧾 Output
Name Type Description
approval_matrix JSON Array of { level, approver_sys_id, approver_name, approver_email }
Scenario:
A flow runs when an “Expense Request” is submitted.
Instead of assigning approvals manually, this Flow Action:
Takes the requester’s Sys ID.
Retrieves their manager hierarchy up to 3 levels.
Dynamically generates approvals (e.g., Manager → Department Head → Director).
Flow setup example:
Trigger: New Expense Request submitted.
Action: Generate Approval Matrix (input: current.user.sys_id, levels = 3).
Loop: For each approver in matrix → Create approval record.
Result: Fully dynamic, hierarchy-based approval flow.
🧩 Key Benefits
🔁 No hardcoding — adapts to real org chart changes.
🧱 Reusable across multiple approval workflows.
🧮 Supports configurable depth (1–N levels).
🧼 Self-contained — no external tables or integrations.