Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Cannot edit a record in Purchase lines history (PurchLineHistory). Update on a valid time state table is not allowed without specifying a ValidTimeStateUpdateMode.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All while renaming the Batch number i got this error

Cannot edit a record in Purchase lines history (PurchLineHistory). Update on a valid time state table is not allowed without specifying a ValidTimeStateUpdateMode.

67241.error.jpg

what could be the reason ?

need help.

*This post is locked for comments

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Cannot edit a record in Purchase lines history (PurchLineHistory). Update on a valid time state table is not allowed without specifying a ValidTimeStateUpdateMode.

    In general I'm very uncomfortable with renaming primary keys in tables. I guess that's what you were trying to do. As you can see, all kinds of issues can occur.

    The problem here is that the table in question is a "valid time state" controlled table (msdn.microsoft.com/.../gg861781.aspx). You can't update them as you can normal tables, instead you have to specify a ValidTimeStateUpdateMode. And it seems that the standard AX "rename primary key" functionality doesn't know how to handle this.

    In this case you would have to update the record with ValidTimeStateUpdateMode::Correction, which will update the existing record. I would suggest you just try to update it with a job. You will find instructions on how to implement it from the article that I linked.

    However if / when the whole primary key renaming has to happen in one transaction, it's a bit more tricky. One option could be the following:

    1) Change the batch id of the purchLine to some other batch id, which already exists in the system

    2) Rename your batch id

    3) Change the batch id of the purch line to the newly renamed batch id

    But you are doing this at your own risk. My suggestion is to never update the primary keys in the first place.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans