Map to body
Function: Map to body
This function helps you transform a list of data records into a new list where each record is formatted as a distinct data object. It's particularly useful when you need to prepare data from one format for use in another system or action that expects individual data objects.
Input,
- List: This is the original list of data records you want to transform. Each item in this list is expected to be a data record that might contain various details, including an
id,createdBy,creationDate,modifiedBy,modificationDate, and a mainpayload(the core data). This input is required and cannot be empty.
Output,
- The mapped list name: This is the new list generated by the function. Each item in this list will be an object, containing the original
payloaddata along with anyid,createdBy,creationDate,modifiedBy, andmodificationDatefields that were present in the original data record.
Execution Flow,
Real-Life Examples,
Example 1: Preparing Customer Data for an External CRM
Imagine you have a list of new customer sign-ups from your website, and you need to send this data to an external Customer Relationship Management (CRM) system. The CRM expects each customer's details as a separate object.
- Inputs:
- List:
[
\{
"id": "cust_001",
"payload": \{
"firstName": "Alice",
"lastName": "Smith",
"email": "[email protected]"
\},
"creationDate": "2023-10-26T10:00:00Z",
"createdBy": "WebsiteForm"
\},
\{
"id": "cust_002",
"payload": \{
"firstName": "Bob",
"lastName": "Johnson",
"email": "[email protected]"
\},
"creationDate": "2023-10-26T10:15:00Z",
"createdBy": "WebsiteForm"
\}
]
- List:
- Result: A new list named "Mapped Customer Data" is created, where each customer's details are now a standalone object, ready to be sent to the CRM.
[
\{
"id": "cust_001",
"firstName": "Alice",
"lastName": "Smith",
"email": "[email protected]",
"creationDate": "2023-10-26T10:00:00Z",
"createdBy": "WebsiteForm"
\},
\{
"id": "cust_002",
"firstName": "Bob",
"lastName": "Johnson",
"email": "[email protected]",
"creationDate": "2023-10-26T10:15:00Z",
"createdBy": "WebsiteForm"
\}
]
Example 2: Consolidating Product Inventory for a Reporting Dashboard
You have a list of product updates from various inventory systems, and you want to consolidate them into a single format for a reporting dashboard. Each update includes product details and who last modified it.
- Inputs:
- List:
[
\{
"id": "prod_A123",
"payload": \{
"productName": "Laptop Pro",
"stock": 50,
"price": 1200.00
\},
"modifiedBy": "WarehouseManager",
"modificationDate": "2023-10-25T14:30:00Z"
\},
\{
"id": "prod_B456",
"payload": \{
"productName": "Wireless Mouse",
"stock": 200,
"price": 25.00
\},
"modifiedBy": "InventoryBot",
"modificationDate": "2023-10-25T15:00:00Z"
\}
]
- List:
- Result: A new list named "Mapped Product Inventory" is generated, where each product's details and modification history are combined into a single object, suitable for display on the dashboard.
[
\{
"id": "prod_A123",
"productName": "Laptop Pro",
"stock": 50,
"price": 1200.00,
"modifiedBy": "WarehouseManager",
"modificationDate": "2023-10-25T14:30:00Z"
\},
\{
"id": "prod_B456",
"productName": "Wireless Mouse",
"stock": 200,
"price": 25.00,
"modifiedBy": "InventoryBot",
"modificationDate": "2023-10-25T15:00:00Z"
\}
]
Example 3: Processing Order Status Updates for a Notification System
Your e-commerce platform generates a list of order status changes, and you need to format these changes into individual messages for a customer notification system.
- Inputs:
- List:
[
\{
"id": "order_789",
"payload": \{
"status": "Shipped",
"trackingNumber": "TRK12345"
\},
"modifiedBy": "ShippingDept",
"modificationDate": "2023-10-26T11:00:00Z"
\},
\{
"id": "order_101",
"payload": \{
"status": "Delivered"
\},
"modifiedBy": "DeliveryDriver",
"modificationDate": "2023-10-26T16:00:00Z"
\}
]
- List:
- Result: A new list named "Mapped Order Updates" is created. Each item in this list is an object containing the order ID, its new status, tracking information (if available), and the details of who and when the status was last updated. This list can then be used to trigger individual customer notifications.
[
\{
"id": "order_789",
"status": "Shipped",
"trackingNumber": "TRK12345",
"modifiedBy": "ShippingDept",
"modificationDate": "2023-10-26T11:00:00Z"
\},
\{
"id": "order_101",
"status": "Delivered",
"modifiedBy": "DeliveryDriver",
"modificationDate": "2023-10-26T16:00:00Z"
\}
]