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)

Is it possible to update the last modified date of an object/table through document services?

(0) ShareShare
ReportReport
Posted on by 415

I am creating a synchronization process to keep data in sync with outside sources.  It is key for me to be able to update that last modified date.

Anybody help on this would be greatly appreciated.

 

Thanks,

Jason Lambert

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Klaas Deforche Profile Picture
    2,433 on at

    Hi,

    It is, (I didn't try that yet, but) check Amir's blog:

    msdax.wordpress.com/.../how-to-update-the-system-fields-of-the-table-like-modifieddatetime

    Best regards,

    Klaas.

    Edit: I was to fast, and didn't notice you want it to happen via AIF.
    It should be possible though (I doubt you can do it in standard AX), you can modify the framework and allow that to happen.
    I will sleep on this :-).

  • Jason Lambert Profile Picture
    415 on at

    Yes, I did see this.  But I was hoping to somehow be able to just add it to the document service.  I don't know how to make that field visible in the document service itself.  I can't find a way to select it.  I assume there is a manual way to do it but have not found it yet.

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

    These system fields are not intended to be changed by anybody else than the AX kernel (regardless whether it is possible or not). Why don't you just make a new field for your purposes?

  • Klaas Deforche Profile Picture
    2,433 on at

    Hi Jason,

    I agree with Martin, it would be better to add a new field (and leave it at that).

    If storing the datetime in the new field is ok, you're all set,

    and if it's not, and your really (really really) want to update the modifieddatetime, you could still sync the two fieldst in the update method of your table. Then there is no need to modify the framework.

    It's not pretty, but I understand you want to do those kind of things sometimes :).

  • Jason Lambert Profile Picture
    415 on at

    Yeah, i think I may need to do what you said and create a new field and then sync it.  This is for a data synchronization utility I am creating to sync data between ax and salesforce.  It would be nice to update the actual fields.  I use this to figure out when things have changed.  So I would need to create logic to update this new field anytime there is a change to a record.  

    So you would say the best place to put that logic would be in the update method of the table?

    Thanks for the advice.

    Jason

  • Brandon Wiese Profile Picture
    17,788 on at

    if you set the method .overwriteSystemFields(true) on a record, then it will let you change the created/modified fields.  You can find examples of this in the BatchRun class.

  • Jason Lambert Profile Picture
    415 on at

    That would work if I was in the client but since I am doing it via AIF document services I don't think that is going to work for me.  I haven't figured out a way to expose it via document services for one thing.  And I don't think i would be able to call the overwriteSystemFields function through there.  I could be wrong though.

  • Suggested answer
    JohnRobertson Profile Picture
    on at

    check the Class\AxGenerateAXBCClass and method generate

    comment out:

    fieldcnt = sytDictTable.fieldCntWithoutSys();

    replace with

    fieldCnt = sysDictTable.fieldCnt();

    This change allows you to expose the System Generated fields like ModifiedDateTime and CreatedDateTime

    certainly for inbound aif calls you can query over the data using the dateTime fields.

  • Verified answer
    Denis Patrakov Profile Picture
    on at

    [quote user="Brandon Wiese"]if you set the method .overwriteSystemFields(true) on a record, then it will let you change the created/modified fields.[/quote]This only works when you insert a record, but not when you update it. Otherwise it would ruin the Audit Trial feature, for instance.
    [quote user="Jason Lambert"]It is key for me to be able to update that last modified date.[/quote]Sorry, but I'm afraid you can't do that using any means provided by the AX kernel except for direct SQL statements.
    Anyway, if for some reason you need to set the modifiedDateTime field value to something other then the current UTC date/time (which you generally get in case you update a record) then you might use other options like USN (Update Sequence Number) in Active Directory, see this technet article for details.

  • Jason Lambert Profile Picture
    415 on at

    Since I can't update the modifiedDateTime field directly I am just going to create a new field and have it update that field when the modifiedDateTime field updates.  

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