I have never, actually, noticed, there are lambda expressions in Web API.
It seems this part of documentation was updated about a year ago, I just did not know there was this addition. Well, it’s nice it’s all on github now, so I can actually go there and see when something was added. Just in case I wanted to figure out how long I’ve been unaware – from that standpoint, I’ve been certainly hitting the records lately.
Why are lambda expressions worth mentioning?
Those are, really, your “exists” / “not exists” with Web API.
There are two flavors:
- all: allows you to build a filter that will be applied to all related records, and, if all of them meet the criteria, the query will return data
- any: same as above in terms of records and relationships, but this time the query will return data if there is at least one related record that meets the condition
So, basically, we start with the main entity, then we add all/any expressions through the relationships, and each of those all/any can have conditions on the related records. More specifically, “any” can be used without conditions, but “all” has to have some conditions:
<ORG_URL>/api/data/v9.1/accounts?$select=name&$filter=contact_customer_accounts/any() and contact_customer_accounts/all(c:c/emailaddress1 ne null)
That’s pretty cool, huh? And we can use this in the Flows with the List Records action when defining the filters.
Anyway, that’s some useful stuff, it seems. And, for the original docs, just have a look here: