Approvals : Configuration Examples

This page provides examples of the Default Approval Mappers for specific Integrations which are able to Mirror the Approvals from the External System.

Pre-requisite

Before leveraging any of these Default Mappers, we need to understand how Approvals are configured. You can follow this guide to learn How to Configure Approvals.

Service Now

The below Mappers can be leveraged based on the Ticket type you are trying to configure for Mirroring, in this integration since they all have the same Attributes in the API response which Moveworks.

INCIDENT / RITM / TASK / KNOWLEDGE

{
  "requested_for.user_id": "requested_for.user_id.$TRIM() OR $[\"b@nner_augmenting_data\"].ticket.requested_for.record_id.$TRIM() OR NULL",
  "requested_for.type": {
    "COALESCE()": {
      "items": [
        {
          "CONDITIONAL()": {
            "condition": "val",
            "context": {
              "val": "requested_for.user_id"
            },
            "on_fail": "NULL",
            "on_pass": "\"ITSM_USER_ID\""
          }
        },
        "\"RECORD_ID\""
      ]
    }
  },
  "requester.user_id": "requester.user_id.$TRIM() OR $[\"b@nner_augmenting_data\"].ticket.created_by.record_id.$TRIM() OR NULL",
  "requester.type": {
    "COALESCE()": {
      "items": [
        {
          "CONDITIONAL()": {
            "condition": "val",
            "context": {
              "val": "requester.user_id"
            },
            "on_fail": "NULL",
            "on_pass": "\"ITSM_USER_ID\""
          }
        },
        "\"RECORD_ID\""
      ]
    }
  },
  "short_description": "$[\"b@nner_augmenting_data\"].ticket.short_description",
  "display_pairs": [
    {
      "value": "display_pairs"
    },
    {
      "value": {
        "MAP()": {
          "converter": {
            "CONDITIONAL()": {
              "condition": "item.display_value != \"false\"",
              "on_pass": {
                "key": "item.label",
                "value": "item.display_value"
              }
            }
          },
          "items": {
            "SORT()": {
              "items": "$[\"b@nner_augmenting_data\"].ticket.ticket_vars",
              "key": "item.order or 0"
            }
          }
        }
      }
    }
  ]
}

SERVICE REQUEST

{
  "short_description": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].req_table_data[0].short_description THEN $[\"b@nner_augmenting_data\"].req_table_data[0].short_description.display_value OR \"\" ELSE NULL)))",
  "display_pairs": [
    {
      "value": "display_pairs"
    },
    {
      "value": {
        "MAP()": {
          "converter": {
            "CONDITIONAL()": {
              "condition": "item.display_value != \"false\"",
              "on_pass": {
                "key": "item.label",
                "value": "item.display_value"
              }
            }
          },
          "items": {
            "SORT()": {
              "items": "$[\"b@nner_augmenting_data\"].ticket.ticket_vars",
              "key": "item.order or 0"
            }
          }
        }
      }
    },
    {
      "key": "\"Opened by\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].req_table_data[0].opened_by THEN $[\"b@nner_augmenting_data\"].req_table_data[0].opened_by.display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Opened\"",
      "value": "$TIMECONV($TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].req_table_data[0].opened_at THEN $[\"b@nner_augmenting_data\"].req_table_data[0].opened_at.display_value OR \"\" ELSE NULL))), NULL, \"%b. %d, %Y - %I:%M %p %Z\", NULL, \"UTC\")"
    },
    {
      "key": "\"Request State\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].req_table_data[0].request_state THEN $[\"b@nner_augmenting_data\"].req_table_data[0].request_state.display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Description\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].req_table_data[0].description THEN $[\"b@nner_augmenting_data\"].req_table_data[0].description.display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Total Price\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].req_table_data[0].price THEN $[\"b@nner_augmenting_data\"].req_table_data[0].price.display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"List of RITMs\"",
      "value": {
        "MAP()": {
          "converter": {
            "value": [
              {
                "key": "\"----\"",
                "value": "\"----\""
              },
              {
                "key": "item.number.display_value",
                "value": "$TRIM($TEXT($TRIM(IF item.short_description THEN item.short_description.display_value OR \"\" ELSE NULL)))"
              },
              {
                "key": "\"Item\"",
                "value": "$TRIM($TEXT($TRIM(IF item.cat_item THEN item.cat_item.display_value OR \"\" ELSE NULL)))"
              },
              {
                "key": "\"Quantity\"",
                "value": "$TRIM($TEXT($TRIM(IF item.quantity THEN item.quantity.display_value OR \"\" ELSE NULL)))"
              },
              {
                "key": "\"Price\"",
                "value": "$TRIM($TEXT($TRIM(IF item.price THEN item.price.display_value OR \"\" ELSE NULL)))"
              }
            ]
          },
          "items": {
            "SORT()": {
              "items": "$[\"b@nner_augmenting_data\"].req_item_table_data",
              "key": "item.number.display_value"
            }
          }
        }
      }
    }
  ]
}

CHANGE REQUEST

{
  "short_description": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0].short_description THEN $[\"b@nner_augmenting_data\"].ticket_data[0].short_description.display_value OR \"\" ELSE NULL)))",
  "display_pairs": [
    {
      "value": "display_pairs"
    },
    {
      "key": "\"Priority\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0].priority THEN $[\"b@nner_augmenting_data\"].ticket_data[0].priority.display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Change Type\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0].type THEN $[\"b@nner_augmenting_data\"].ticket_data[0].type.display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Assignment Group\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0][\"assignment_group.name\"] THEN $[\"b@nner_augmenting_data\"].ticket_data[0][\"assignment_group.name\"].display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Configuration Item\"",
      "value": "$CONCAT([$[\"b@nner_augmenting_data\"].ticket_data[0].cmdb_ci.display_value, $[\"b@nner_augmenting_data\"].ticket_data[0][\"cmdb_ci.install_status\"].display_value], \" - \", TRUE)"
    },
    {
      "key": "\"Business Justification\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0].justification THEN $[\"b@nner_augmenting_data\"].ticket_data[0].justification.display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Change scheduled from\"",
      "value": "$TIMECONV($TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0].start_date THEN $[\"b@nner_augmenting_data\"].ticket_data[0].start_date.display_value OR \"\" ELSE NULL))), NULL, \"%b. %d, %Y - %I:%M %p %Z\", NULL, \"UTC\")"
    },
    {
      "key": "\"Change scheduled until\"",
      "value": "$TIMECONV($TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0].end_date THEN $[\"b@nner_augmenting_data\"].ticket_data[0].end_date.display_value OR \"\" ELSE NULL))), NULL, \"%b. %d, %Y - %I:%M %p %Z\", NULL, \"UTC\")"
    },
    {
      "key": "\"Approver(s) List\"",
      "value": {
        "CONDITIONAL()": {
          "condition": "$LENGTH(items) <= 5",
          "context": {
            "items": {
              "FILTER()": {
                "items": {
                  "MAP()": {
                    "converter": "item[\"approver.name\"].display_value.$TRIM()",
                    "items": "$[\"b@nner_augmenting_data\"].additional_approvers"
                  }
                }
              }
            }
          },
          "on_fail": {
            "RENDER()": {
              "args": {
                "items": "$CONCAT(items[:5], \", \")",
                "num_extra": "$LENGTH(items) - 5"
              },
              "template": "{{ items }} (+{{ num_extra }})"
            }
          },
          "on_pass": "$CONCAT(items, \", \")"
        }
      }
    }
  ]
}

HR CASE

{
  "short_description": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0].short_description THEN $[\"b@nner_augmenting_data\"].ticket_data[0].short_description.display_value OR \"\" ELSE NULL)))",
  "display_pairs": [
    {
      "value": "display_pairs"
    },
    {
      "key": "\"Priority\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0].priority THEN $[\"b@nner_augmenting_data\"].ticket_data[0].priority.display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Assignment Group\"",
      "value": "$TRIM($TEXT($TRIM(IF $[\"b@nner_augmenting_data\"].ticket_data[0][\"assignment_group.name\"] THEN $[\"b@nner_augmenting_data\"].ticket_data[0][\"assignment_group.name\"].display_value OR \"\" ELSE NULL)))"
    },
    {
      "key": "\"Configuration Item\"",
      "value": "NULL"
    }
  ]
}

POLICY EXCEPTION

[
  {
    "value": "display_pairs"
  },
  {
    "value": {
      "CONDITIONAL()": {
        "condition": "$LENGTH(items) <= 5",
        "context": {
          "items": {
            "FILTER()": {
              "items": {
                "MAP()": {
                  "converter": "item[\"approver.name\"].display_value.$TRIM()",
                  "items": "$[\"b@nner_augmenting_data\"].additional_approvers"
                }
              }
            }
          }
        },
        "on_fail": {
          "RENDER()": {
            "args": {
              "items": "$CONCAT(items[:5], \", \")",
              "num_extra": "$LENGTH(items) - 5"
            },
            "template": "{{ items }} (+{{ num_extra }})"
          }
        },
        "on_pass": "$CONCAT(items, \", \")"
      }
    }
  }
]

Workday

Leave of Absence

{
  "display_pairs": [
    {
      "value": "display_pairs"
    },
    {
      "key": "\"Person taking leave\"",
      "value": "$[\"b@nner_augmenting_data\"].workday_absence_management.worker_descriptor"
    },
    {
      "key": "\"Last day of work\"",
      "value": "$TIMECONV($[\"b@nner_augmenting_data\"].workday_absence_management.last_day_of_work, \"%Y-%m-%d\", \"%b. %d, %Y\")"
    },
    {
      "key": "\"Leave type\"",
      "value": "($SPLIT($[\"b@nner_augmenting_data\"].workday_absence_management.leave_type, \" > \"))[-1]"
    },
    {
      "key": "\"Time requested\"",
      "value": {
        "CONDITIONAL()": {
          "condition": "start AND end",
          "context": {
            "end": "$TIMECONV($[\"b@nner_augmenting_data\"].workday_absence_management.estimated_last_day_of_leave, \"%Y-%m-%d\", \"%A %b. %d, %Y\", NULL, NULL, FALSE)",
            "start": "$TIMECONV($[\"b@nner_augmenting_data\"].workday_absence_management.first_day_of_leave, \"%Y-%m-%d\", \"%A %b. %d, %Y\", NULL, NULL, FALSE)"
          },
          "on_fail": "\"\"",
          "on_pass": {
            "RENDER()": {
              "template": "{{ start }} :arrow_right: {{ end }}"
            }
          }
        }
      }
    },
    {
      "key": "\"Note\"",
      "value": "$[\"b@nner_augmenting_data\"].workday_absence_management.latest_leave_comment"
    }
  ]
}

Expense

{
  "display_pairs": [
    {
      "value": "display_pairs"
    },
    {
      "key": "\"Transaction date\"",
      "value": "$TIMECONV($[\"b@nner_augmenting_data\"].expense_details.Transaction_Date, \"%Y-%m-%d\", \"%b. %d, %Y\")"
    },
    {
      "key": "\"Total cost\"",
      "value": "$CURRENCY_FORMAT($DECIMAL($[\"b@nner_augmenting_data\"].expense_details.Transaction_Amount_Signed) * 100, \"USD\")"
    },
    {
      "value": {
        "CONDITIONAL()": {
          "condition": "$[\"b@nner_augmenting_data\"].expense_details.Expense_Report_Lines_group",
          "on_pass": {
            "FILTER()": {
              "items": {
                "FLATTEN()": [
                  {
                    "key": {
                      "RENDER()": {
                        "args": "$LENGTH($[\"b@nner_augmenting_data\"].expense_details.Expense_Report_Lines_group)",
                        "template": "Line items ({{ . }})"
                      }
                    },
                    "value": "\":point_down: ----------\""
                  },
                  {
                    "FLATTEN()": {
                      "MAP()": {
                        "converter": [
                          {
                            "key": {
                              "RENDER()": {
                                "template": ":book: Item {{ loop.index1 }}"
                              }
                            },
                            "value": "item.Transaction_Description OR \" N/A \""
                          },
                          {
                            "CONDITIONAL()": {
                              "condition": "item.Expense_Report_Line_Memo",
                              "on_pass": {
                                "key": "\"Description\"",
                                "value": "item.Expense_Report_Line_Memo"
                              }
                            }
                          },
                          {
                            "key": "\"Cost\"",
                            "value": "$CURRENCY_FORMAT($DECIMAL(item.Transaction_Amount) * 100, \"USD\")"
                          }
                        ],
                        "items": "$[\"b@nner_augmenting_data\"].expense_details.Expense_Report_Lines_group"
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    }
  ]
}

Sailpoint

ACCESS REVIEW

{
  "identifier": {
    "id": "$[\"@id\"]",
    "domain": "\"IT_DOMAIN\""
  },
  "requested_for.user_id": "$[\"@targetId\"]",
  "requested_for.type": "\"IDM_USER_ID\"",
  "approver.user_id": "$[\"@WorkItem__owner__id\"]",
  "approver.type": "\"IDM_USER_ID\"",
  "status": {
    "COALESCE()": {
      "items": [
        {
          "LOOKUP()": {
            "key": "$[\"@summaryStatus\"]",
            "mapping": {
              "Challenged": "\"DENIED\"",
              "Complete": "\"APPROVED\"",
              "Delegated": "\"NO_ANSWER\"",
              "Open": "\"PENDING\"",
              "Returned": "\"NO_ANSWER\"",
              "WaitingReview": "\"PENDING\""
            }
          }
        },
        "\"UNKNOWN\""
      ]
    }
  },
  "created_at": "$TIMECONV($[\"@created\"], \"MILLIS\")",
  "updated_at": "$TIMECONV($[\"@modified\"].$TRIM() OR $[\"@created\"].$TRIM() OR NULL, \"MILLIS\")",
  "display_pairs": [
    {
      "key": "\"Need action by\"",
      "value": "$TIMECONV($TIMECONV($[\"@WorkItem__expiration\"], \"MILLIS\"), NULL, \"%b. %d, %Y - %I:%M %p %Z\", NULL, \"UTC\")"
    },
    {
      "key": "\"Type\"",
      "value": "\"Access Review\""
    },
    {
      "value": {
        "MAP()": {
          "converter": {
            "key": {
              "RENDER()": {
                "args": {
                  "loop": "loop",
                  "type": "item[\"@type\"].$REPLACE(\"([a-z])([A-Z])\", \"\\1 \\2\")"
                },
                "template": "{{& type }} ({{ loop.index1 }}/{{ loop.length }})"
              }
            },
            "value": {
              "LOOKUP()": {
                "default": "item[\"@targetDisplayName\"] OR \"<Unknown>\"",
                "key": "item[\"@type\"]",
                "mapping": {
                  "Account": {
                    "RENDER()": {
                      "args": {
                        "account": "item.ExceptionEntitlements.EntitlementSnapshot[\"@displayName\"]",
                        "application": "item[\"@exceptionApplication\"] OR \"<Unknown Application>\""
                      },
                      "template": "Account {{& account }} on {{& application }}"
                    }
                  },
                  "AccountGroupMembership": {
                    "RENDER()": {
                      "args": {
                        "account": "item[\"@targetDisplayName\"] OR \"<Unknown Account>\"",
                        "application": "item[\"@exceptionApplication\"] OR \"<Unknown Application>\""
                      },
                      "template": "Account {{& account }} on {{& application }}"
                    }
                  },
                  "Bundle": "item[\"@bundle\"]",
                  "BusinessRoleProfile": {
                    "CONCAT()": {
                      "items": {
                        "MAP()": {
                          "converter": "item",
                          "items": "item.ApplicationNames"
                        }
                      },
                      "separator": "\", \""
                    }
                  },
                  "DataOwner": {
                    "RENDER()": {
                      "args": {
                        "application": "item[\"@exceptionApplication\"] OR \"<Unknown Application>\"",
                        "target": "item[\"@targetName\"] OR \"<Unknown Account>\""
                      },
                      "template": "Account {{& target }} on {{& application }}"
                    }
                  },
                  "Exception": {
                    "RENDER()": {
                      "args": {
                        "application": "item[\"@exceptionApplication\"] OR \"<Unknown Application>\"",
                        "relationship": "item[\"@exceptionAttributeName\"] OR \"<Unknown Relationship>\"",
                        "value": "item[\"@exceptionAttributeValue\"] OR \"<Unknown>\""
                      },
                      "template": "{{& relationship }} for application {{& application }} ({{& value }})"
                    }
                  },
                  "PolicyViolation": "item[\"@violationSummary\"] OR \"<Unknown Violation>\""
                }
              }
            }
          },
          "items": "$[\"CertificationItem/..\"]"
        }
      }
    }
  ],
  "short_description": "IF $[\"@type\"] THEN $CONCAT([$[\"@type\"], \" Access Review\"]) ELSE NULL",
  "domain": "\"IT_DOMAIN\"",
  "parent_id": "$[\"@certification__id\"]"
}

REQUEST_ITEM

{
  "identifier": {
    "id": "$[\"@id\"].$TRIM() OR $[\"@workItemId\"].$TRIM() OR NULL",
    "display_value": "$[\"@name\"]",
    "domain": "\"IT_DOMAIN\""
  },
  "requester.user_id": "$[\"Requester/Reference\"][\"@id\"]",
  "requester.type": "\"IDM_USER_ID\"",
  "requested_for.user_id": "$[\"@targetId\"].$TRIM() OR $[\"@targetName\"].$TRIM() OR NULL",
  "requested_for.type": "\"IDM_USER_ID\"",
  "approver.user_id": "$[\"Owner/Reference\"][\"@id\"].$TRIM() OR $[\"@owner\"].$TRIM() OR NULL",
  "approver.type": "\"IDM_USER_ID\"",
  "status": {
    "COALESCE()": {
      "items": [
        {
          "LOOKUP()": {
            "key": "$[\"@state\"]",
            "mapping": {
              "Canceled": "\"NO_ANSWER\"",
              "Expired": "\"NO_ANSWER\"",
              "Finished": "\"APPROVED\"",
              "Pending": "\"PENDING\"",
              "Rejected": "\"DENIED\"",
              "Returned": "\"NO_ANSWER\""
            }
          }
        },
        "\"PENDING\""
      ]
    }
  },
  "created_at": "$TIMECONV($[\"@created\"].$TRIM() OR $[\"@startDate\"].$TRIM() OR NULL, \"MILLIS\")",
  "updated_at": "$TIMECONV($[\"@modified\"].$TRIM() OR $[\"@endDate\"].$TRIM() OR $[\"@created\"].$TRIM() OR $[\"@startDate\"].$TRIM() OR NULL, \"MILLIS\")",
  "display_pairs": [
    {
      "value": {
        "MAP()": {
          "converter": {
            "key": {
              "RENDER()": {
                "template": "Request Item - {{ loop.index1 }}/{{ loop.length }}"
              }
            },
            "value": {
              "CONCAT()": {
                "items": [
                  {
                    "CONDITIONAL()": {
                      "condition": "item[\"@\"].operation",
                      "on_pass": {
                        "RENDER()": {
                          "template": "\\n\\tOperation: {{& [email protected] }}"
                        }
                      }
                    }
                  },
                  {
                    "CONDITIONAL()": {
                      "condition": "item[\"@\"].displayname OR item[\"@\"].name",
                      "on_pass": {
                        "CONDITIONAL()": {
                          "condition": "item[\"@\"].displayname",
                          "on_fail": {
                            "RENDER()": {
                              "template": "Role Type: {{& [email protected] }}"
                            }
                          },
                          "on_pass": {
                            "RENDER()": {
                              "template": "Role Type: {{& [email protected] }}"
                            }
                          }
                        }
                      }
                    }
                  },
                  {
                    "CONDITIONAL()": {
                      "condition": "item[\"@\"].displayValue or item[\"@\"].value",
                      "on_pass": {
                        "CONDITIONAL()": {
                          "condition": "item[\"@\"].displayValue",
                          "on_fail": {
                            "RENDER()": {
                              "template": "Role Name: {{& [email protected] }}"
                            }
                          },
                          "on_pass": {
                            "RENDER()": {
                              "template": "Role Name: {{& [email protected] }}"
                            }
                          }
                        }
                      }
                    }
                  },
                  {
                    "CONDITIONAL()": {
                      "condition": "item[\"@\"].application",
                      "on_pass": {
                        "RENDER()": {
                          "template": "Application: {{& [email protected] }}"
                        }
                      }
                    }
                  }
                ],
                "separator": "\"\\n\\t\""
              }
            }
          },
          "items": "$[\"Attributes/Map/entry[@key='approvalSet']/value/ApprovalSet\"] OR ApprovalSet"
        }
      }
    },
    {
      "key": "\"Priority\"",
      "value": "$[\"@level\"]"
    },
    {
      "key": "\"Type\"",
      "value": "\"Access Request\""
    }
  ],
  "short_description": {
    "COALESCE()": {
      "items": [
        {
          "RENDER()": {
            "template": "{{& Description }}"
          }
        },
        "$[\"@request\"]"
      ]
    }
  },
  "domain": "\"IT_DOMAIN\"",
  "parent_id": "$[\"@identityRequestId\"]",
  "metadata": {
    "record_id": "$[\"@id\"].$TRIM() OR $[\"@workItemId\"].$TRIM() OR NULL"
  }
}