Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

API: Format error in $filter of agedAccountPayables by agedAsOfDate

(1) ShareShare
ReportReport
Posted on by 13
Hi,
 
I'm getting a strange error trying to $filter `agedAccountsPayables` (or Receivables) by `agedAsOfDate` as it always tells me the format of the date is wrong.  The exact same format of $filter works for e.g. `purchaseOrders` by `orderDate`.
 
Is this a bug in the API, or something I am misunderstanding?
 
Examples using the Cronus sample database (with some manual word-wrapping for clarity:
 
GET https:/api.businesscentral.dynamics.com/v2.0/{{tenant}}/production/api/v2.0/agedAccountsPayables?company=CRONUS UK Ltd.&$filter=agedAsOfDate ge 2024-02-01
{
  /error/: {
    /code/: /Application_EvaluateException/,
    /message/: /The format of the Date '>=02/01/24' does not match your device's date settings.//r///r/Make sure that the day, month, and year are in the correct order and use the correct separator (such as - or /). Alternatively, you can always use the format 'yyyy-mm-dd'.  CorrelationId:  b750524a-573b-475f-bdbf-6c85024937be./
  }
}
 
GET https:/api.businesscentral.dynamics.com/v2.0/{{tenant}}/production/api/v2.0/purchaseOrders?company=CRONUS UK Ltd.&$filter=orderDate gt 2024-04-08
{
  /@odata.context/: https:/api.businesscentral.dynamics.com/v2.0/070927bf-7189-4b3c-99b5-60f306d9b138/production/api/v2.0/$metadata#purchaseOrders/,
  /value/: [...results...]
}
 
 
You can see that I am indeed sending in yyyy-mm-dd format that it says you can always use, but the error suggests it has internally been converted to US format dates (and my tenant is a UK one).
 
Very strange that it works for purchaseOrders, but not for agedAccountsPayables.
 
Any suggestions would be much appreciated!
 
 
 
  • Verified answer
    RT-01051226-0 Profile Picture
    13 on at
    API: Format error in $filter of agedAccountPayables by agedAsOfDate
    Worked out my mistake - agedAsOfDate should of course use an `eq` not `gt`.  The error message made no sense, but the error was using the wrong operator in the $filter.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,886 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,768 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans