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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Dynamics 365 (On Premises): Using createdon Date in the OData $filter is giving "UserId is empty guid"! error

(0) ShareShare
ReportReport
Posted on by 10

I am using the following OData query in the POST man and is giving the error i.e.

The following query works fine i.e. http://<organisation-url>/api/data/v9.0/ngt_assignments(173554B4-A103-EC11-8117-005056814F19)?$select=ngt_assignmentid, createdon

But when I use the following in $filter query i.e. and%20createdon%20ge%202022-02-21 filter as per below Url i.e.

http://<organisation-url>/api/data/v9.0/ngt_assignments(173554B4-A103-EC11-8117-005056814F19)?$select=ngt_assignmentid, createdon&$filter=createdon%20ge%202022-02-21

Then, I got the following error i.e.

"error": { "code": "0x80040217", "message": "UserId is empty guid! ", "innererror": { "message": "UserId is empty guid! ", "type": "Microsoft.Crm.BusinessEntities.CrmObjectNotFoundException", "stacktrace": " at Microsoft.Crm.Caching.UserDataCacheLoader.<>c__DisplayClass2_0.b__0()\r\n at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func1 func)\r\n at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func1 func)\r\n at Microsoft.Crm.Caching.ObjectModelCacheLoader2.LoadCacheDataInternal(TKey key, Object existingDataContainer, IOrganizationContext context)\r\n at Microsoft.Crm.Caching.ObjectModelCacheLoader2.LoadCacheData(TKey key, IOrganizationContext context)\r\n at Microsoft.Crm.Caching.CrmMultiOrgCacheBase2.CreateEntry(TKey key, IOrganizationContext context)\r\n at Microsoft.Crm.Caching.CrmMultiOrgCacheBase2.<>c__DisplayClass19_0.b__2()\r\n at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)\r\n at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)\r\n at Microsoft.Crm.Caching.CrmMultiOrgCacheBase2.LookupEntry(TKey key, IOrganizationContext context)\r\n at Microsoft.Crm.BusinessEntities.CrmDateTimeBuilderBase.ConvertUtcTimeToUserTime(DateTime utcTime, IUserAndOrganizationContext userAndOrganizationContext)\r\n at Microsoft.Crm.BusinessEntities.DynamicCrmDateTimeBuilder.ConvertToCrmDateTime(DateTime dateTime, IUserAndOrganizationContext userAndOrganizationContext, DateTimeToCrmDateTimeConversionStrategy strategy)\r\n at Microsoft.Crm.Query.DateTimeConditionParser.GetCrmDateTime(AttributeMetadata attribute, Object value, IUserAndOrganizationContext userAndOrganizationContext)\r\n at Microsoft.Crm.Query.ConditionExpression..ctor(AttributeMetadata attribute, ConditionOperator conditionOperator, Array values, Boolean isCustom, IUserAndOrganizationContext userAndOrganizationContext, DynamicMetadataCache cache)\r\n at Microsoft.Crm.Extensibility.OData.DataQueryOptionsConverter.GetConditionExpression(Object leftVal, BinaryOperatorNode node, Object rightVal, Boolean negateOperator)\r\n at Microsoft.Crm.Extensibility.OData.DataQueryOptionsConverter.BindBinaryOperatorNode(BinaryOperatorNode binaryOperatorNode, FilterExpression parentFilter, Boolean negateOperator)\r\n at Microsoft.Crm.Extensibility.OData.QueryOptionsConverterBase4.Bind(QueryNode node, TFilterExpression parentFilter, Boolean negateOperator, XrmMetadataEntityMetadata metadata)\r\n at Microsoft.Crm.Extensibility.OData.DataQueryOptionsConverter.BindBinaryOperatorNode(BinaryOperatorNode binaryOperatorNode, FilterExpression parentFilter, Boolean negateOperator)\r\n at Microsoft.Crm.Extensibility.OData.QueryOptionsConverterBase4.Bind(QueryNode node, TFilterExpression parentFilter, Boolean negateOperator, XrmMetadataEntityMetadata metadata)\r\n at Microsoft.Crm.Extensibility.OData.QueryOptionsConverterBase4.BindFilterClause(FilterClause filterClause, XrmMetadataEntityMetadata metadata, Object[] args)\r\n at Microsoft.Crm.Extensibility.OData.DataQueryOptionsConverter.SetFilterExpression(EntityExpression qe, FilterQueryOption filterQueryOption, XrmMetadataEntityMetadata metadata)\r\n at Microsoft.Crm.Extensibility.OData.QueryOptionsConverterBase4.GetQueryExpression(ODataQueryOptions queryOptions, String edmEntityName, CrmODataExecutionContext context, XrmMetadataEntityMetadata metadata)\r\n at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.RetrieveEdmEntity(CrmODataExecutionContext context, String edmEntityName, String entityKeyValue, ODataQueryOptions queryOptions)\r\n at Microsoft.Crm.Extensibility.OData.EntityController.GetEntityImplementation(String& entityName, String key)\r\n at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func1 func)\r\n at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func1 func)\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.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 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.Web.Http.Controllers.ApiControllerActionInvoker.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.Web.Http.Controllers.ActionFilterResult.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.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()" } } }

Quick help is really appreciated.

I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    usually with the operator ge and datetime I use the full date (like 2022-08-10T06:48:00.000Z) eventually you can use the operator Microsoft.Dynamics.CRM.OnOrAfter to just match the date, something like

    $filter=Microsoft.Dynamics.CRM.OnOrAfter(PropertyName='sample_dateandtime',PropertyValue='2022-08-05')

    however you can use my tool Dataverse REST Builder (as you are onpremise I suggest to use the managed solution as the XrmToolBox version may not work for you) to generate the requests and execute them.

    hope it helps

  • Naveed Anwar Profile Picture
    10 on at

    Hi Guido,

    Thanks for the info.

    The suggested method worked i.e. $filter=Microsoft.Dynamics.CRM.OnOrAfter(PropertyName='sample_dateandtime',PropertyValue='2022-08-05')

    But the following are working on other custom entities but not the one which I am using i.e.

    $filter = createdon ge 2021-02-28T06:48:00.000Z (Not Worked on one of the custom entity and is working for others)

    or

    $filter = createdon ge 2021-02-28 (Not Worked on one of the custom entity and is working for others)

    Thanks once again for your help in this regard!

    Cheers,

    Naveed.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 73 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans