Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Automatically update document date when opening SO page

Posted on by Microsoft Employee

Hi Dear,

Request : change the document date to workdate when the user enters the Sales Order Page

I know it's an old request (cf. 2005) ! How to manage this in RTC ?

and avoid "You cannot make any changes in the database until a transaction has been started. Sales order must close..."

TIA,

L

*This post is locked for comments

  • Suggested answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Automatically update document date when opening SO page

    Hi Louis,

    I don't receive "You cannot make any changes ..." error.

    May be it is caused by another customization, can you trace it by debugging?

    Or may be you can try COMMIT function.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Automatically update document date when opening SO page

    Tx 4Bz

    Form is not in the scope of my request, but I think there is no problem with the form triggers.

    The issue is when I open an existing SO, not a new one (no problem in this case).

    MyRequest : change the document date to workdate when the user enters the Sales Order Page for an existing SO.

    Best regards,

    L

  • Suggested answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Automatically update document date when opening SO page

    Hi Louis,

    Yes, there is no OnAfterGetCurrentRecord trigger for Page. But does it work for Form?

    For me, just input VALIDATE("Document Date", WORKDATE); in OnAfterGetRecord trigger of Page.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Automatically update document date when opening SO page

    Tx Tharanga.

    I agree with this, but it's far from a "clean" change of the date when entering the page, with the Document Date field validations.

    In final, I think that a trigger (OnAfterGetCurrentRec) is cruelly missing in NAV2009R2...

    Kind regards,

    L

  • Suggested answer
    TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Automatically update document date when opening SO page

    Agreed with Mohana,

    Write the below code in OnAfterGetRecord() trigger

    "Document Date" := WORKDATE;

    And then write the modify code in the OnQueryClosePage() trigger

    MODIFY;



  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Automatically update document date when opening SO page

    Tx Mohana

    Just > Currpage.update, which is necessary to show the new date

    Best regards,

    L

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Automatically update document date when opening SO page

    It seems like you have written below code in OnAfterGetRecord trigger

    "Document Date" := WORKDATE;

    MODIFY;

    Please move MODIFY; to OnQueryClose trigger and try.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Automatically update document date when opening SO page

    Tx Francis.

    This gives the message :

    "You cannot make any changes in the database until a transaction has been started. Sales order must close..."

    Best regards,

    L

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Automatically update document date when opening SO page

    Hi,

    did you try putting the code on the OnAftergetRecord trigger on the page ?

    You might consider doing it conditionally (if WORKDATE <> "Document Date")

    kind regards,

    Francis

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Automatically update document date when opening SO page

    Hi

    My challenge is to change the Document date when the user come back to an existing SO.

    From the list of existing SO, you double click on one SO, the request of my customer is to change automatically the Document date when the Sales order appears in the page.

    Version is NAV2009R2 and the OnAfterGetCurrentRec doesn't exist...

    Regards,

    L

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans