Let us know so we can improve!
The online Trailblazer Community is now read-only. [Read the FAQ] [Get Help]
Extracts a specific field from each object in a list, returning a list of those field values. It supports both simple arrays and complex object structures.
This helper is available in the Winter ’26 release of Marketing Cloud Next.
1{{map list fieldName}}| Parameter | Type | Description |
|---|---|---|
list | Array | Required. The list of objects to map. |
fieldName | String | Required. The field to extract from each object. If the field doesn’t exist in an object, that object is skipped. |
The function returns a new list containing the values of the specified field from each object in the input list. If the specified field isn’t present in an object, that object is skipped. If a parameter is missing or an element in the list isn’t a valid map, the function throws an exception.
This example shows how to use the map function to extract the age field from each object in the list.
1myList = [
2 {
3 "name": "D’Angelo",
4 "country": "Sweden",
5 "age": 30
6 },
7 {
8 "name": "Miguel",
9 "country": "Canada",
10 "age": 25
11 },
12 {
13 "name": "Lakshmi",
14 "country": "United States"
15 }
16];
17
18{{map myList "age"}}The function returns [30, 25].
You can chain the map function with other functions such as filter, sort, and flatten.
1myList = [{"name": "D’Angelo", "age": 24}, {"name": "Miguel", "age": 27}, {"name": "Lakshmi", "age": 26}];
2
3{{map (filter myList "age" ">" 25 "number") "name"}}The function returns ["Miguel", "Lakshmi"].
With complex nested objects, use the flatten function to flatten the nested objects before you map the values, as shown in this example.
1myList = {
2 "orders": [
3 {
4 "items": [
5 {"name": "Reticulated Widget", "price": 100},
6 {"name": "Quantum Toaster", "price": 200}
7 ]
8 },
9 {
10 "items": [
11 {"name": "Retro Encapsulator", "price": 300}
12 ]
13 }
14 ]
15};
16
17{{map (flatten (map myList "items")) "price"}}The function returns [100, 200, 300].