Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com
Yesterday I wrote a post on the lambda query operators in Dynamics 365 WebAPI. And there a showed you how using the the lambda query operator all(), you can find all incidents (cases) which does not have any open tasks associated with it.
In this blog, I am back with another requirement and this time I going to use the lambda operator or(). And this time my requirement is little more complex than the previous one. Here I need to find Incidents (cases) which have at-least one associated email from a specific sender.
To know more about lambda operators you can refer to this Microsoft Docs article.
Coming back to the requirement, below is a sample case with couple of emails.
The case here have couple of emails, one from Cathan cook and the other from Debajit Dutta. My requirement here is to find any case which has at-least one email from Cathan cook. Well, that sounds complex. But trust me with the new lambda operator – any(), it’s piece of cake
So let’s see the query then.
https://<organization_url>/api/data/v9.1/incidents?$select=title%20&$filter=Incident_Emails/any(o:contains(o/sender, ‘ccook@xrm20208.onmicrosoft.com’))
And below is the result when I run this query in the browser.
As you can see, it returns the case that I was looking for. Wonderful isn’t it?
Hope this helps!
Debajit Dutta
(Microsoft MVP)
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.
Is it possible to get the top notes of the case records with this approach
can u let me know your exact requirement