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 :
Small and medium business | Business Central, N...
Suggested answer

Report.Run now behaves as if it were a modal execution

(0) ShareShare
ReportReport
Posted on by 291

Good morning all.

In the lates versions, I has to change my code, and when I had a report.run, now I had to add before a commit, because Report.run now behaves as report.runmodal.

Is the any other way to solve this? becuase I flee from commits as the plage ;-)

Thank you ever so much

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: Report.Run now behaves as if it were a modal execution

    Please share your code in Txt format only.

    Thanks.

  • JJMc Profile Picture
    291 on at
    RE: Report.Run now behaves as if it were a modal execution

           Cust.FindFirst();

           Cust.Name += '#';

           Cust.Modify();

           Report.Run(Report::"Customer - Top 10 List");

    Then I get this error:

    Los siguientes métodos de AL solo se pueden usar de forma limitada en transacciones de escritura porque se bloquearán una o más tablas:

    No se permite Form.RunModal en transacciones de escritura.

    Codeunit.Run solo se permite en transacciones de escritura si no se usa el valor de retorno. Por ejemplo, 'OK := Codeunit.Run()' no está permitido.

    Report.RunModal solo se permite en transacciones de escritura si 'RequestForm = false'. Por ejemplo, 'Report.RunModal(...,false)' sí está permitido.

    XmlPort.RunModal solo se permite en transacciones de escritura si 'RequestForm = false'. Por ejemplo, 'XmlPort.RunModal(...,false)' sí está permitido.

    Use el método commit para guardar los cambios antes de esta llamada o cambie la estructura del código..

    Póngase en contacto con el desarrollador de la aplicación para obtener más ayuda.

  • Suggested answer
    DAnny3211 Profile Picture
    11,391 on at
    RE: Report.Run now behaves as if it were a modal execution

    hi

    look this

    learn.microsoft.com/.../reportinstance-run-method

    DAniele

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,071 Moderator on at
    RE: Report.Run now behaves as if it were a modal execution

    Why do you need to modify the customername before you run the report?

    If you skip that the report should run fine I think.

  • JJMc Profile Picture
    291 on at
    RE: Report.Run now behaves as if it were a modal execution

    Thank you Daniele for your answer, but I do not see your point.

    I understand what a object.runmodal is and work, but I do not understand why now a report.run behaves as report.runmodal

  • JJMc Profile Picture
    291 on at
    RE: Report.Run now behaves as if it were a modal execution

    That was not real code. It was just an example to prove or show that now report.run after a modify, delete or insert operation, behaves the same as report.runmodal.

    Thank you anyway for taking your time reading and answering this question

  • Suggested answer
    YUN ZHU Profile Picture
    94,353 Super User 2025 Season 2 on at
    RE: Report.Run now behaves as if it were a modal execution

    Hi, I tested the code below and it works without issue. So I think the problem should have nothing to do with Report.Run method.

    pastedimage1676251291817v2.png

    pastedimage1676251269093v1.png

    Hope this can give you some hints.

    Thanks.

    ZHU

  • JJMc Profile Picture
    291 on at
    RE: Report.Run now behaves as if it were a modal execution

    Thank you ZHU for your reply, but I can see you do not modify, insert o delete any record in any table. That' is why you do not have any issue.

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: Report.Run now behaves as if it were a modal execution

    Hi,

    Try below

    commit;      

    Cust.FindFirst();

          Cust.Name += '#';

          Cust.Modify();

          Report.Run(Report::"Customer - Top 10 List");

  • Suggested answer
    YUN ZHU Profile Picture
    94,353 Super User 2025 Season 2 on at
    RE: Report.Run now behaves as if it were a modal execution

    Hi, I understand what you mean. In this case, if you need to use Report.Run, you need to add a Commit.

    For example,

    pastedimage1676273476280v1.png

    Hope this helps.

    Thankks.

    ZHU

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,901

#2
YUN ZHU Profile Picture

YUN ZHU 2,079 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 2,041

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans