Available filters List of filters that can be used to generate validations, triggers, and templates. false W3sidGl0bGUiOiJBdXRvbWF0aW9uIiwidXJsIjoiL2RldmVsb3BlcnMvYXV0b21hdGlvbi8ifSx7InRpdGxlIjoiUGlwZUxhbmciLCJ1cmwiOiIvZGV2ZWxvcGVycy9hdXRvbWF0aW9uL3BpcGUtbGFuZy8ifSx7InRpdGxlIjoiRXhwcmVzc2lvbiBsYW5ndWFnZSIsInVybCI6Ii9kZXZlbG9wZXJzL2F1dG9tYXRpb24vcGlwZS1sYW5nL2V4cHJlc3Npb25sYW5ndWFnZS8ifV0= Automation /developers/automation/ ["developers","Automation"] ["developers","Automation","PipeLang"] developers

Available filters

List of filters that can be used to generate validations, triggers, and templates.

NameDescription
firstReturns the first item of collection
(order.availableOrderProducts | first).status.code == "in-reserve"
lastReturns the last item of collection
(order.orderProducts | last).canceled # Condition will be met, if the last item in order is in cancellation status 
containsReturns true, if at least one item of collection matches the condition
order.orderProducts | contains(item => item.status.code == "in-reserve") # Condition will be met, if at least one item in order is in "In reserve" status
everyReturns true, if all items of collection match the condition

# Attention! Condition also will be met for empty collection

order.availableOrderProducts | every(item => item.status.code == "in-reserve") # Condition will be met, if if all not cancelled items in order are in "In reserve" status
filterReturns the collection filtered by some condition
order.orderProducts | filter(item => item.summ > 1000 ) | contains(item => item.status.code == "in-reserve") # Condition will be met, if at least one item with sum more than 1000 is in "In reserve" status
mapChanges each item of collection
order.orderProducts | map( x => x.offer )  # converts the collection of order items to the collection of offers
reduceReturns the result of calculation aggregated the entire collection
# Order content:
#   Skirt  2 pcs
#   Shorts 1 pcs
#   Shirt  5 pcs

order.availableOrderProducts | reduce( (sum, x) => sum + x.quantity ) # 8
order.availableOrderProducts | reduce( (sum, x) => sum + x.quantity, 7 ) # 15
flattenConverts the two-dimensional collection into one-dimensional
(order.orderProducts | map ( x => x.packs ) | flatten | sort( (a, b) => a.shipmentDate < b.shipmentDate) | first).shipmentDate < order.deliveryDate # condition will be met, if maximum date of items picking is less than delivery date
sortSorts the collection by specified condition
(order.availableOrderProducts | sort( (a, b) => a.summ < b.summ ) | first).status.code == "in-reserve" # Condition will be met, if the most expensive item in order is reserved
lengthReturns the quantity of collection items
(order.orderProducts | length) > 5 # Condition will be met, if there are more than 5 items in order
is_subscribedReturns the customers's subscription flag (type Customer) to the specified channel (email, sms or waba).
customer|is_subscribed('sms')
You can also check subscription to a specific category in the channel by passing the subscription category code as the second argument.
customer|is_subscribed('email', 'news')
Thank you for your feedback.
Was this article helpful?
No
  • The recommendations did not help
  • There is no answer to my question
  • The text is difficult to understand
  • I do not like the described functionality
Yes
Previous article
Available functions
Main and auxiliary functions available when working with system objects.