Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Common Data Service Trigger: Filter based on lookup value


I am trying to trigger my Cloud Flow whenever a certain field on a linked entity is not null. Is there any way how to achieve that using the CDS (current) connector?

The equivalent OData query looks like this:

$filter=(_originatingleadid_value ne null and originatingleadid/dw_hubspotid_str ne null) and (originatingleadid/leadid ne null)




I tried the following, but it wont work:



I receive the following error message:

  "error": {
    "message""Exception parsing _originatingleadid_value ne null and originatingleadid/dw_hubspotid_str ne null and originatingleadid/leadid ne null submitted for attribute filterexpression of callback registration. Target entity: account. Exception: Microsoft.OData.ODataException: Could not find a property named 'originatingleadid' on type 'CallbackRegistration.account'.\r\n   at Microsoft.OData.UriParser.InnerPathTokenBinder.BindInnerPathSegment(InnerPathToken segmentToken)\r\n   at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)\r\n   at Microsoft.OData.UriParser.EndPathBinder.BindEndPath(EndPathToken endPathToken)\r\n   at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)\r\n   at Microsoft.OData.UriParser.BinaryOperatorBinder.GetOperandFromToken(BinaryOperatorKind operatorKind, QueryToken queryToken)\r\n   at Microsoft.OData.UriParser.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)\r\n   at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)\r\n   at Microsoft.OData.UriParser.BinaryOperatorBinder.GetOperandFromToken(BinaryOperatorKind operatorKind, QueryToken queryToken)\r\n   at Microsoft.OData.UriParser.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)\r\n   at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)\r\n   at Microsoft.OData.UriParser.BinaryOperatorBinder.GetOperandFromToken(BinaryOperatorKind operatorKind, QueryToken queryToken)\r\n   at Microsoft.OData.UriParser.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)\r\n   at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)\r\n   at Microsoft.OData.UriParser.FilterBinder.BindFilter(QueryToken filter)\r\n   at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilterImplementation(String filter, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)\r\n   at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilter()\r\n   at System.Web.OData.Query.FilterQueryOption.get_FilterClause()\r\n   at System.Web.OData.Query.FilterQueryOption.ApplyTo(IQueryable query, ODataQuerySettings querySettings)\r\n   at System.Web.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)\r\n   at System.Web.OData.Query.ODataQueryOptions`1.ApplyTo(IQueryable query)\r\n   at Microsoft.Crm.ObjectModel.EdmModelEvaluator.EvaluateFilterExpression(String filterExpression, ODataQueryOptions queryOptions)\r\n   at Microsoft.Crm.ObjectModel.EdmModelEvaluator.EvaluateFilterExpression(String filterExpression)\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationService.<>c.<.cctor>b__31_0(EdmModelEvaluator evaluator, String testValue)\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationService.ValidateInputEntity(IBusinessEntity entity, ExecutionContext context, IFeatureDetailContainer featureDetailContainer)"

Can someone help me solving this problem? Or isnt it possible at all?
Solution Sage
Solution Sage

Hi @StefanBre ,


To my understanding you are filtering on linked entity which is not even there in Plugins / Workflows , so ideally you can only filter by look up value and not fields inside that entity.



Regular Visitor

Hi @ManishJain,

thank you for your reply. 

This is really a pity, I was hoping that this would work with Cloud Flows. Too bad! I just wanted to avoid unnecessary executions of the flow.

Regular Visitor

We are experiencing a similar problem.

Solution Sage
Solution Sage

Hi @D365ZAGuy , @StefanBre ,


Considering Flow as an alternate solution to Plugins / Workflows available in D365 , it is trying to follow similar route. You can only trigger plugin / workflow based on parent record attributes and not linked ones. 


If you want to achieve this functionality please put the current entity filtering attributes and then in next action use get record based on the lookup value and then do your filtering after it. 



Helpful resources

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,468)