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.
  • Leo99 Profile Picture
    85 on at
    RE: Changing Report Layout in a Events Subscriber Procedure

    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

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,021 Moderator on at
    RE: Changing Report Layout in a Events Subscriber Procedure

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,281 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,019 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans