Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

using AIF services to query data

Posted on by 1,272

Hi,
I am using the following code to query Purchase Orders from AX 2012 R2.

string time = "12/7/2008 08:32:51";
QueryCriteria qc = new QueryCriteria();
CriteriaElement ce = new CriteriaElement();
ce.DataSourceName = "PurchTable";
ce.FieldName = "modifiedDateTime";
ce.Operator = Operator.Equal;
ce.Value1 = time;
CriteriaElement[] cce = new CriteriaElement[1];

cce[0] = ce;
qc.CriteriaElement = cce;
PO = svcClient.find(callContext, qc);

but i am geting the error UTC date\time string is not in the expected format. have anyone tried this and can tell me the correct format?

i can fetch data using other fields but i want to use the modified date time field.

Please Help

Thanks

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: using AIF services to query data

    Very helpfull Martin,

    I made at small adjustment to the format

    yyyy-MM-ddTHH:mm:ss  using Capital letters for month and for 24 Hour.

  • dynamics developer Profile Picture
    dynamics developer 1,272 on at
    RE: using AIF services to query data

    Thanks Martin

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: using AIF services to query data

    The right format is yyyy-mm-ddThh:mm:ss - you can get it easily by formatting a DateTime instance with "s" format, e.g. new DateTime(2008, 12, 7, 8, 32, 51).ToString("s");

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans