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)

Modify system fields value

(0) ShareShare
ReportReport
Posted on by

Hi everybody!

Is possible to modify the value of the "createdBy" field of a record by code??
I would like to do it by JOB, is it possible?


I have tried this, but it does not work fine.
sampleTable.(fieldNum(Table, CreatedBy) = 'DM-Admin'; //User id - If possible get from SysUserInfo table

In the debugger it looks great, but in the table no...
This code works when you run it in the server(by class), but not in a job.

Anyone kwnos another way to modify that field value or to run a job on server withour using a class?? (I can´t stop the server!!)

Thanks everybody!!
Ander

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    You can't modify them, AFAIK (except of hacking data directly in database, which isn't supported). You potentially can override them on insert, e.g. when you're restoring an unintentionally deleted record, but you can't change values of existing records.

    What business problem are you trying to resolve by changing values of system fields?

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    I thought that overWriteSystemFields() worked only on insert().

    It's because I follow my own advice and don't do things like that. :-)

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    You can only do this if you execute the code in the context of another user with the runAs() call.

    msdn.microsoft.com/.../aa893873.aspx

    But please note that using such method adds a whole lot of other headaches, such as you cannot catch exceptions correctly raised inside that method, since it has it's own TTS level and infolog application context.

  • Community Member Profile Picture
    on at

    Thanks Martin, Crispin and Vilmos.

    We wanted to create a job to insert data into a table that we use to filter the PurchTable. Our table contains a "userID" field and the system "createdBy" field.  And the query what we use to filter the purch table, has a range in the created by field and a relation between our table "userId" and the purchTable "createdBy".

    Forget the first question, we are going to create another field instead the createdby field.

    Thankyou very much anyway!! :)

  • Vilmos Kintera Profile Picture
    46,149 on at

    No worries. Make sure to mark helpful answers to resolve the topic, cheers!

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans