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 NAV (Archived)

Call an Update Report from OnInsert trigger

(0) ShareShare
ReportReport
Posted on by 18

Hi,

I am trying to automate a Production Refresh when a Production Line is created.

However, when I add the report.run in the OnInsert, I get an error that the transaction type can't be chagned from UpdateLocks to Update.

Is there a way I could call the update report Asynchronously so that it does it after the insert transaction is completed?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Suresh Kulla Profile Picture
    50,241 Super User 2025 Season 2 on at
    RE: Call an Update Report from OnInsert trigger

    Create a copy of the refresh production order report and change the Transaction Type to UpdateLocks and use that in the Oninsert.

  • SamCha Profile Picture
    18 on at
    RE: Call an Update Report from OnInsert trigger

    Edit: Nevermind this message.

  • SamCha Profile Picture
    18 on at
    RE: Call an Update Report from OnInsert trigger

    It works, but I get this error. Not sure why it tries to add it a second time.

    "Prod. Order Line already exists"

    I tried from the Table Line OnInsert and also from the Page OnInsert, and it does the same error.

  • SamCha Profile Picture
    18 on at
    RE: Call an Update Report from OnInsert trigger

    I tried adding a "Commit" before my call to the update report, but it didn't help.

    Any other ideas?

  • Verified answer
    Suresh Kulla Profile Picture
    50,241 Super User 2025 Season 2 on at
    RE: Call an Update Report from OnInsert trigger

    Why you want to run the refresh production order on line insert ? are you planning to calculate components/routings ? if you are planning to calculate lines then it will not make any sense to do that during insert of a line. If you want to calculate components then on the report make sure you uncheck the lines to calculate.

  • SamCha Profile Picture
    18 on at
    RE: Call an Update Report from OnInsert trigger

    Yes I want it to calculate components automatiacally when we add a line.

    Otherwise, people forget to do it and post an empty production...

  • SamCha Profile Picture
    18 on at
    RE: Call an Update Report from OnInsert trigger

    Ok, one step further now.

    By setting CalcLines it doesn't error out, but the line at that point is not created yet (since I'm still in the OnInsert trigger).

    So the component calculation works only for the first line when I insert a second line, so I always have hte last one that is not calculated.

    I guess I'll need another place to use call that code. Is there an afterinsert on the Page?

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 NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans