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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

The value that you are trying to add or subtract creates an invalid utcdatetime

(0) ShareShare
ReportReport
Posted on by

Hi All,

I am currently working in AX2012.When I am trying to rename the user id through "Rename primary key" button I am getting the below error message.

"The value that you are trying to add or subtract creates an invalid utcdatetime.

Cannot edit a record in User to person relationship (DirPersonUser).
Update must be performed inside a transaction.

(S)\Classes\xRecord\Update
(S)\Data Dictionary\Tables\DirPersonUser\Methods\Update - line 3
(S)\Classes\xRecord\Update
(S)\Classes\xRecord\renamePrimaryKey
(C)\Forms\SysRecordInfo\Methods\renamePrimaryKey - line 48
(C)\Forms\SysRecordInfo\Designs\DesignList\SysRenameKey\Methods\Clicked - line 3".

Note there is neither customization in "SysRecordInfo" form or "DirPersonUser" table. Still I am facing this issue.

Please let me know if anybody has faced similar issue and solved this issue.

Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    299,030 Super User 2025 Season 2 on at
    RE: The value that you are trying to add or subtract creates an invalid utcdatetime

    Hi Harini,

    On what form or table do you try to rename the user ID? Have you also tried removing the User to person relation ship before renaming the ID? Then after renaming, you can add the relationship again.

  • Community Member Profile Picture
    on at
    RE: The value that you are trying to add or subtract creates an invalid utcdatetime

    Hi Andre,

    Thanks for your replay. I am trying to rename the user id of "UserInfo" table. Basically I am trying to rename the user id from the form which is accessible from System administration -> Common -> Users -> Users. Then I have selected a user id and right clicked on the record-> Record info -> Rename[button].

    Basically when I try to rename the user id through this process I also want user id to be updated in all the related screens and also in User to person relation ship screen.

    I failed removing the relation of User to person relation ship as the relation is defined in Sys layer and I am currently working in USR layer.

    Regards,

    Harini SJ

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: The value that you are trying to add or subtract creates an invalid utcdatetime

    UserId is a special field, like it is stored in system fields where CreatedBy/ModifiedBy properties are set.

    If you would expect to update those fields based on the primary key rename feature, I would expect errors as well, since you explicitly need to specify overwritesystemfields flag on those (https://community.dynamics.com/ax/b/amirsaxspace/archive/2011/04/07/how-to-update-the-system-fields-of-the-table-like-modifieddatetime).

    Most likely you cannot rename a user in AX due to the above based on my "smart guess", but I have not tried to do it myself.

    What would be the business requirement behind this? Why don't you just remove the user and add it with a new ID?

  • Community Member Profile Picture
    on at
    RE: The value that you are trying to add or subtract creates an invalid utcdatetime

    Hi Vilmos Kintera,

    Requirement is all the existing users are assigned a new user id.

    Removing the old user id and creating new user id creates workaround. We have approximately 7000+ users in our system and we need to rename all the user id.

    Regards,

    Harini SJ

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: The value that you are trying to add or subtract creates an invalid utcdatetime

    I actually found in the documentation that renaming UserId field should be technically possible:

    technet.microsoft.com/.../aa548139.aspx

    If you are getting an error, that is something unique to your environment, i.e. you have used special non-alphanumeric characters, or have some edts/fields/relations/code modified that causes the issue.

    You would have to debug it yourself to get it resolved, or provide a lot more details including debugging so we could reproduce the issue.

    The likely cause is you have a ttsAbort or an extra ttsCommit which changes the transaction isolation level at an earlier step during a tables' insert or update.

    You could do an SQL Profiler trace for updates records, and see which one is the last changed value in the transaction before you hit the error, and the one before that, and that should tell you the table names which are likely the problematic ones.

  • André Arnaud de Calavon Profile Picture
    299,030 Super User 2025 Season 2 on at
    RE: The value that you are trying to add or subtract creates an invalid utcdatetime

    Hi Harini,

    I was not referring to changing table relations. You could delete the record(s) in the table which stored the relation between user and worker to prevent getting this error.

    Renaming should work in AX2012. I have done it several times before without getting this error.

  • Community Member Profile Picture
    on at
    RE: The value that you are trying to add or subtract creates an invalid utcdatetime

    Hi Vilmos and Andre,

    Thanks for the replay. I forgot to mention this issue occurs occasionally.

    I can also see Steven Kick had also faced similar issue in the below link

    "community.dynamics.com/.../78497"

    I have also tried deleting the record from "HcmPositionDetail" table and I am facing the same error mentioned in the above link.

    As mentioned earlier there is no customization in "SysRecordInfo" form or "DirPersonUser" table.

    I have tried debugging the code and I can see the renamePrimaryKey method of "SysRecordInfo" form is invoked first.This method has ttsBegin and ttsCommit. "RenamePrimaryKey" method of "SysRecordInfo" form invokes "renamePrimaryKey()" method of "xRecord" class. I can not view the code present in "renamePrimaryKey()" method of "xRecord" class.

    Below is the stack trace

    "The value that you are trying to add or subtract creates an invalid utcdatetime.

    Cannot edit a record in User to person relationship (DirPersonUser).

    Update must be performed inside a transaction.

    (S)\Classes\xRecord\Update

    (S)\Data Dictionary\Tables\DirPersonUser\Methods\Update - line 3

    (S)\Classes\xRecord\Update

    (S)\Classes\xRecord\renamePrimaryKey

    (C)\Forms\SysRecordInfo\Methods\renamePrimaryKey - line 48

    (C)\Forms\SysRecordInfo\Designs\DesignList\SysRenameKey\Methods\Clicked - line 3".

    Regards,

    Harini SJ

  • Suggested answer
    vijaysharma Profile Picture
    2 on at
    RE: The value that you are trying to add or subtract creates an invalid utcdatetime

    HI,

    My suggestion is remove all user id exclude (admin and guest id)

    then add user id.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans