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

Changing Report Layout in a Events Subscriber Procedure

(0) ShareShare
ReportReport
Posted on by 85
Hi ,
I have an Event Subscriber that gets called for Drop Shipment function. Inside the event Subscriber I would like to change the layout of the standard Purchase order. The Report :: line is showing me an error. Can someone please take a look at it. The error says "end expected"
[EventSubscriber(ObjectType::Table, Database::"Purchase Line", 'OnValidateVariantCodeOnBeforeDropShipmentError', '', true, true)]
    local procedure dropShipProcedure()
    begin
        Report:: "Standard Purchase - Order" = './layout/DropshipPurchaseOrder.docx';
        Message('This is a drop shipment');
    end;
Regards.
I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    If what you are trying to do is the execute the report you must use the report.execute or report.print commands.

    Please see this doc:

    docs.microsoft.com/.../reportinstance-execute-method

    The report = method will not be recognized i think.

  • Leo99 Profile Picture
    85 on at

    It won't let me execute during that event.

    The following AL methods are limited during write transactions because one or more tables will be locked:

    Form.RunModal is not allowed in write transactions.

    Codeunit.Run is allowed in write transactions only if the return value is not used. For example, 'OK := Codeunit.Run()' is not allowed.

    Report.RunModal is allowed in write transactions only if 'RequestForm = false'. For example, 'Report.RunModal(...,false)' is allowed.

    XmlPort.RunModal is allowed in write transactions only if 'RequestForm = false'. For example, 'XmlPort.RunModal(...,false)' is allowed.

    Use the commit method to save the changes before this call, or structure the code differently.

    Contact your application developer for further assistance.

    Thanks for the reply

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,785

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,007 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 948 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans