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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Updating Enumeration Type value in Table

(0) ShareShare
ReportReport
Posted on by 160

Hello,

I'm new to developing in AX and am currently working in the AX 2012 R2 AOT.  I've recently come across a problem that i cannot find any answers to on the web or in development  manuals.

I'm struggling with the following issue, I need to update an enumeration type element in a table from a certain value to the next.  Here is an abstract version of my running code.

while

select table

Enum _enum;

_enum = getEnum(par1,par2,par3); //getEnum returns the correct enumeration object I want in the table of the same enumeration type of the table field.

ttsBegin;

table.EnumField = _enum;

table.update();

ttsCommit;

I've stepped through every single procedure and determined that the table.update() statement is giving me the following error when running the code:

"Cannot create a record in Addresses (LogisticsPostalAddres). Insert not supported with the values specifieed for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records."

After researching the error I believe It's caused by an exception being thrown out by the Valid time state/date effective Framework but I'm unsure why the .update() query is causing this on a totally non-related field that I'm trying to update.

Are there any AX gurus out there that know why or how the .update() statement executes regarding enumeration type values and why I'm getting Valid Time State/Date effective Framework error?

(P.S Just to reiterate I'm new to development in Microsoft Dynamics AX 2012 and I apologize if I've missed something basic, any help would be greatly appreciated.)

*This post is locked for comments

I have the same question (0)
  • Dick Wenning Profile Picture
    8,705 Moderator on at

    you are hid by nasty stuff, it is logic on the dirparty table data.

    add these lines

    LogisticsPostalAddres.updateMode = ValidTimeStateUpdate::Correction;

  • Brendon Breedt Profile Picture
    160 on at

    Hi Dick,

    Thanks a lot for your response it has given me more insight as to what is at fault.  I've gone and declared the table container of LogisticsPostalAddress as logisticsPostalAddress and added the following code:

    logisticsPostalAddress.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);

    But unfortunately to no effect, I'm still getting the same error when running the code.  I thought it might be an environmental issue so I tested on another environment as well and I'm receiving the same error there.  

    I've tried to have a look at how the Valid Time State/Date effective Framework is used in the .update() method but could not find any documentation regarding this.  I've implemented the exact same structure in another table and the code works perfectly the only difference in this instance would be that I'm using an enumeration type as a data type when trying to write back into the table.

    I'm still unsure as to why dirparty table data is included when trying to update an enumeration field in a table?

  • Verified answer
    Brendon Breedt Profile Picture
    160 on at

    I've found the reason for this error.

    The error is generated when an attempt is made to update a Enumeration field with an uninitialized Enumeration value.  

    When going through the code I found an exception where the Enumeration value to be used for updating in the table did not get initialized.  After fixing this the code executed perfectly.

  • Community Member Profile Picture
    on at

    Hi Brendon,

    I have same situation like you, how did you solve?

    Thanks in advanced,

    eity182

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans