1. Overview
✅ This Joget snippet helps you decide who the next approver should be based on whether a request is escalated or not.
✅ If the item is not escalated, the script takes the requester’s higher-level manager and stores it as the next line manager.
✅ If the item is already escalated, the script keeps moving up the hierarchy by using the previously stored manager value.
✅ In real workflows, this is useful when approval paths depend on organizational levels instead of a fixed list of users.
2. How It Works
⚙️ The script reads a form field that tells Joget whether the record is escalated.
⚙️ If the value is not Yes , it fetches the manager information from the requestor and saves two workflow variables:
⚙️ LineManager for the next approver email.
⚙️ CurrentLineManager for the username of the current hierarchy level.
⚙️ If the value is Yes , the script reuses the previously stored CurrentLineManager and moves one step higher.
⚙️ The idea is simple: keep pushing the workflow to the right person…