Skip to content

Instantly share code, notes, and snippets.

@varazir
Last active April 29, 2022 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save varazir/f9c714f8193e45531e8c5fbcdc57e61b to your computer and use it in GitHub Desktop.
Save varazir/f9c714f8193e45531e8c5fbcdc57e61b to your computer and use it in GitHub Desktop.
Approval flow
{% assign firstapprovers = "{{R2.approver1}},{{R2.approver2}},{{R2.approver3}},{{R2.approver4}}" %}
{% assign secondapprovers = "{{R3.approver1}},{{R3.approver2}},{{R3.approver3}},{{R3.approver4}}" %}
{% assign managerappowner = "{{P1.root.requester.reporting_manager_id}},{{R1.application_owner}}" %}
{% assign approval_type = "{{R1.approval_type}}" %}
{% if {{ticket.tags}} contains "approveStage1" %}
{% if {{ticket.tags}} contains "ApproveStage2" %}
Approved
{% else %}
ApproveStage2
{% if {{R1.manager_second}} or {{R1.application_owner_second}} %}
{% if managerappowner contains "{{ticket.requester.id}}" %}
Approved
{% else %}
{% if {{R1.manager_second}} %}
manager
{% else %}
appowner
{% endif %}
{% endif %}
{% else %}
{{approval_type}}
{% endif %}
{% endif %}
{% else %}
approveStage1
{% if secondapprovers contains "{{ticket.requester.id}}" %}
Approved
{% elsif firstapprovers contains "{{ticket.requester.id}}" %}
ApproveStage2
{% if {{R1.approval_type}} != blank %}
{{approval_type}}
{% else %}
Approved
{% endif %}
{% else %}
{% if {{R1.manager_first}} or {{R1.application_owner_first}} %}
{% if managerappowner contains "{{ticket.requester.id}}" %}
{% if {{R1.approval_type}} != blank %}
{{approval_type}}
{% else %}
Approved
{% endif %}
{% else %}
{% if {{R1.manager_first}} %}
manager
{% else %}
appowner
{% endif %}
{% endif %}
{% elsif {{R1.approval_type}} != blank %}
{{approval_type}}
{% else %}
Approved
{% endif %}
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment