web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM Web API issue with guid

(0) ShareShare
ReportReport
Posted on by 337

I am using following uri

api/data/v8.0/new_persons?$filter=_new_employee_id_value eq (guid'b7c6faa1-3ef6-e511-80e8-c4346bddd061')

I am getting following exception when tested in browser

{
"error":{
"code":"","message":"Unrecognized 'Edm.String' literal 'guid'b7c6faa1-3ef6-e511-80e8-c4346bddd061'' at '50' in '_new_employee_id_value eq (guid'b7c6faa1-3ef6-e511-80e8-c4346bddd061')'.","innererror":{
"message":"Unrecognized 'Edm.String' literal 'guid'b7c6faa1-3ef6-e511-80e8-c4346bddd061'' at '50' in '_new_employee_id_value eq (guid'b7c6faa1-3ef6-e511-80e8-c4346bddd061')'.","type":"Microsoft.OData.Core.ODataException","stacktrace":" at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseTypedLiteral(ExpressionLexer lexer, IEdmPrimitiveTypeReference targetTypeReference, String targetTypeName)\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.TryParseLiteral(ExpressionLexer lexer)\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParsePrimaryStart()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParsePrimary()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseUnary()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseMultiplicative()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseAdditive()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseComparison()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseLogicalAnd()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseLogicalOr()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseExpression()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseParenExpression()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParsePrimaryStart()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParsePrimary()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseUnary()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseMultiplicative()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseAdditive()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseComparison()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseLogicalAnd()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseLogicalOr()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseExpression()\r\n at Microsoft.OData.Core.UriParser.Parsers.UriQueryExpressionParser.ParseExpressionText(String expressionText)\r\n at Microsoft.OData.Core.UriParser.ODataQueryOptionParser.ParseFilterImplementation(String filter, ODataUriParserConfiguration configuration, IEdmType elementType, IEdmNavigationSource navigationSource)\r\n at Microsoft.OData.Core.UriParser.ODataQueryOptionParser.ParseFilter()\r\n at System.Web.OData.Query.FilterQueryOption.get_FilterClause()\r\n at Microsoft.Crm.Extensibility.OData.QueryOptionsConverterBase`4.BindFilter(FilterQueryOption filterQuery)\r\n at Microsoft.Crm.Extensibility.OData.DataQueryOptionsConverter.SetFilterExpression(QueryExpression qe, FilterQueryOption filterQueryOption)\r\n at Microsoft.Crm.Extensibility.OData.QueryOptionsConverterBase`4.GetQueryExpression(ODataQueryOptions queryOptions, String edmEntityName, CrmODataExecutionContext context)\r\n at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.RetrieveEdmEntityCollection(CrmODataExecutionContext context, String entityCollectionName, ODataQueryOptions queryOptions)\r\n at Microsoft.Crm.Extensibility.OData.EntityController.GetEntitySetInternal(String entitySetName, String castEntityName, CrmODataExecutionContext context, CrmEdmEntityObjectCollection crmEdmEntityObjectCollection, ODataQueryOptions queryOptions)\r\n at Microsoft.Crm.Extensibility.OData.EntityController.GetEntitySet(String entitySetName)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}
}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    necsa Profile Picture
    3,455 on at
  • Suggested answer
    ChrisC Profile Picture
    630 on at

    I suggest if your filter parameter is a lookup you should have /Id at the end? Otherwise if its the primary key you would use ...new_persons(guid'....') perhaps????

  • Suggested answer
    Abhiram Thulasi Profile Picture
    2 on at

    Hi,

    If you are using new web api for 2016, Please update the filter as follows and try it out.

    api/data/v8.0/new_persons?$filter=_new_employee_id_value eq b7c6faa1-3ef6-e511-80e8-c4346bddd061 (Remove the ('') from the code)

    Also make sure that the back end name of new_employee_id is correct.

    Thanks and Regards,

    Abhiram

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    This is not correct way of using filter in Web API, you can refer our post for the same: http://himbap.com/blog/?p=1997

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans