Moveworks Data Mapper Common Examples
Overview
In Moveworks' real-world scenarios, Bender examples are integral to streamlining processes within the Moveworks platform. These Bender examples are designed to help you write benders faster, showcase how obscure data can be molded into readable and friendly data, and improve your user experience and productivity.
Examples
Display a list of items in a single field
In many scenarios, especially within ticketing or request management systems, there's a need to display aggregate information in a concise and readable format. One common requirement is to list entities such as approvers for a request or tasks associated with a ticket in a single, easily digestible field. This example demonstrates how to accomplish this by aggregating a list of approver names into a single field named approvers
.
Context
Consider a situation where a system generates a payload response containing an array of approvers, each with their name, email, and an external identifier. The goal is to compile these names into a single string that lists all approver names, separated by commas, and display this list in a field called approvers
.
Given Payload Response
{
"approver_list": [
{
"name": "John Doe",
"email": "[email protected]",
"external_id": "123456"
},
{
"name": "Jane Smith",
"email": "[email protected]",
"external_id": "7891011"
},
{
"name": "Alex Johnson",
"email": "[email protected]",
"external_id": "121314"
}
],
"etc...": {}
}
Bender mapping:
{
"approvers": {
"RENDER()": {
"template": "{{ users }}",
"args": {
"users": {
"EVAL()": {
"expression": "$CONCAT(users, ',')",
"args": {
"users": {
"MAP()": {
"items": "approver_list",
"converter": "item.name"
}
}
}
}
}
}
}
}
}
Expected Result:
{
"approvers": "John Doe, Jane Smith, Alex Johnson"
}
Convert an AD distinguished name to readable human format (Name Last_Name)
In various professional environments, particularly those involving ticketing or request management systems, there's often a need to streamline complex or technical information into formats that are more accessible and understandable for end-users. A specific example of this is converting Active Directory (AD) distinguished names into a more human-readable format. This can be especially useful when displaying the names of individuals involved in requests or tasks within a system, where clarity and conciseness are key.
Context
Imagine a scenario in which a system retrieves information in the form of an AD distinguished name. This distinguished name string contains valuable information, such as a user's name, structured in a way that is not immediately intuitive for human reading. The objective is to extract the user's first and last names from this string and present them in a friendly format (Name Last_Name
), thereby enhancing readability and making the information more accessible to users.
Given Payload Response
{"dn": ["CN=Mok\\, Kevin,OU=_User Accounts,OU=Austin,OU=Americas,OU=Moveworks,DC=Moveworks,DC=local"]}
Bender mapping:
The mapping uses the RENDER
operator to format the output based on a template. Within this template, various string manipulation operations are applied to the dn
field to extract and format the user's name. Specifically, the SPLIT
, REPLACE
, and further SPLIT
operations are used to isolate the first and last names from the distinguished name string.
{
"cn_name": {
"RENDER()": {
"template": "{{name}} {{last}}",
"args": {
"last": "dn[0].$SPLIT(\",\")[0].$REPLACE(\"CN=\",\"\").$SPLIT(\"\\\")[0]",
"name": "dn[0].$SPLIT(\",\")[1]"
}
}
}
}
Expected Result:
{
"cn_name": "Kevin Mok"
}
Updated about 1 month ago