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 :
Microsoft Dynamics AX (Archived)

Set Validto field to MaxDate

(0) ShareShare
ReportReport
Posted on by

I am trying to set Max Data on PurchLineHistory, but it didn't work, kindly help to see what is the error (Dynamic AX 2012 R2 CU7)

void job2 ()

{

PurchLineHistory plh;

;

while select forupdate plh where plh.PurchId=="ABC-000123"

{

if(plh)

{

ttsbegin;

plh.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);

plh.ValidTo = DateTimeUtil::maxValue();

plh.update();

ttscommit;

}

}

}

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    seems , select statement is not bringing any data, because you have not specified any validTimeState in your statement? give a try by specifiying dateTime in outside while loop

    while select forUpdate validTimeState(fromDateTime, toDateTime) PurchLineHistory

  • Community Member Profile Picture
    on at

    Something like this?

    its telling me operand type are not compatible with the operator (line9)

    void job2 ()

    {

    PurchLineHistory plh;

    FromDateTime aDate;

    toDateTime bDate;

       ;

       aDate = 1\1\2014;

       bDate = 31\12\2016;

    while select forupdate validTimeState(fromDateTime, toDateTime) plh where plh.PurchId=="ABC-000123"

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    DateTime means Date+Time, not only Date.

    something as below.

    utcdatetime                 minDateTime = DateTimeUtil::utcNow();

       utcdatetime                 currentDateTime = DateTimeUtil::utcNow();

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans