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"
}
Remove empty keys from the output mapper in a return statement
In some cases when working in Agentic Automation your api response will not return certain fields or return them as null and you don't want to provide it to the return statement at all so the llm doesn't pull any context from the fact it's null.
Context
Imagine a scenario in which a Sharepoint system returns PO information and you only want to map specific values from the response to return in your Agentic Automation Plugin. Sometimes certain fields will be null or non existent.
Given Payload Response
{
"data": {
"title": "PO1234",
"status": "Complete",
"email": null,
"country" "US"
}
}
Bender mapping:
The mapping uses the EVAL
operator to run the $FILTER() DSL against the final object to remove any null keys. Within this EVAL the args we are passing through to build the object which we will run the FILTER against.
- return:
output_mapper:
EVAL():
expression: sharepoint_info.$FILTER(x => x)
args:
sharepoint_info:
sp_title: data.title
sp_status: data.status
sp_user: data.email
Expected Result:
{
"sharepoint_info": {
"sp_title": "PO1234",
"sp_status": "Complete"
}
}
Updated 8 days ago