Hi there,
I have an Object Array that looks something like this:
"Account":
[
{"AccountID": "1", "lineofBusiness": "AA", "pymntType": "Cash"},
{"AccountID": "2", "lineofBusiness": "BB", "pymntType": "CreditCard"},
{"AccountID": "3", "lineofBusiness": "CC", "pymntType": "Debit"},
{"AccountID": "4", "lineofBusiness": "CC", "pymntType": "CreditCard"}
]
Let's say I only want to clean up the array to accounts that has pymntType = CreditCard only, so then the expression would look something like this:
filter(#{ExperiencePlatform.Profile.Account, "pymtType", ["CreditCard"]} --> this returns a listObject with pymtType == CreditCard only.
At this point, I have couple questions:
1) What can I do with this listObject? I am not aware of any functions that accept listObject as a parameter
2) How do I extract a value of this new listObject? For example, I want the lineofBusiness at position 0.
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
One of the places where listObject is used on custom actions. Take a look at this documentation.
To retrieve account object values have a look at the collection management functions
One of the places where listObject is used on custom actions. Take a look at this documentation.
To retrieve account object values have a look at the collection management functions
Hi @SatheeskannaK,
Is it possible to extract the listObject with the filter function, then grab a value out of listObject? In my example, something like filter(#{ExperiencePlatform.Profile.Account, "pymtType", ["CreditCard"]}.lineofBusiness
Thanks.
Views
Replies
Total Likes
Can you try along these lines,
serializeList(#{ExperiencePlatform.Profile.Account.all(currentDataPackField.pymntType == "CreditCard").lineOfBusiness}, ",", true)
Expected output: BB,CC
Is it possible to write a condition that only selects profiles with a "lineofBusiness": "CC" and "pymntType": "CreditCard"?
So in this scenario only AccountID 4 would qualify?
Views
Replies
Total Likes
@sbral Yes, it's possible to use collection management functions with AND conditions.
Views
Replies
Total Likes
Can you give an example of what the JSON structure looks like for these functions?
#{ExperiencePlatform.ExperienceEventFieldGroup.experienceevent.all(currentDataPackField._aepgdcdevenablement2.purchase_event.receipt_nbr == "10-337-4016").
_aepgdcdevenablement2.purchase_event.productListItems.all(currentDataPackField.SKU == "AB17 1234 1775 19DT B4DR 8HDK 762").name}
and
#{ExperiencePlatform.ExperienceEventFieldGroup.experienceevent.last(
currentDataPackField.eventType == "commerce.productListAdds").productListItems.last(currentDataPackField.priceTotal >= 150).name}
I'm not sure where the .name portion comes from.
Views
Replies
Total Likes
name is part of the productListItems object.
JSON Structure:
"_aepgdcdevenablement2": {
"purchase_event": {
"receipt_nbr": "10-337-4016",
"productListItems": [
{
"SKU": "AB17 1234 1775 19DT B4DR 8HDK 762",
"name": "Product Name Here",
"priceTotal": 100.0,
"quantity": 1
},
{
"SKU": "Different SKU# Here",
"name": "Product Name Here",
"priceTotal": 50.0,
"quantity": 2
}
]
}
}
----
{
"eventType": "commerce.productListAdds",
"timestamp": "2025-04-12T18:00:00Z",
"productListItems": [
{
"SKU": "ABC-123",
"name": "Shoes",
"priceTotal": 100.00,
"quantity": 1
},
{
"SKU": "DEF-456",
"name": "Dress",
"priceTotal": 169.99,
"quantity": 1
},
{
"SKU": "GHI-789",
"name": "Kids Toy",
"priceTotal": 70.00,
"quantity": 1
}
],
"identityMap": {
"email": [
{
"id": "example@test.com",
"primary": true
}
]
}
}
Views
Replies
Total Likes
Views
Likes
Replies