Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Suppress Messages during a report i.e Confirmation, Standard Dialog.

(0) ShareShare
ReportReport
Posted on by 372

Hello,

I am trying to create a report to batch post warehouse shipments withing NAV 2018. I have it working calling the posting codeunit, however, it has a pop up message for every record that would be reported. i.e selected ship or ship and invoice, and also, the confirmation that the document posted. How can i code into a report to handle these with predetermined values? I know its been done elsewhere in the system but I could not figure it out.

Please do not suggest the other dev forums, cause I cant ask a question on there.

Thanks,

-Chaz Kim

  • ChazKimRP Profile Picture
    ChazKimRP 372 on at
    RE: Suppress Messages during a report i.e Confirmation, Standard Dialog.

    This is it! except I didnt have to use the validation portion, in the report i pass a variable if I want to invoice, so then used that for the value in WhsePostShipment.SetPostingSettings which still allows the user flexability.

    Thanks!

  • Verified answer
    RE: Suppress Messages during a report i.e Confirmation, Standard Dialog.

    Hi, yes exactly - use codeunit 5763 instead, if you want to bypass the manual input. Also notice that on record 7321 there is a function that looks like it turns off Dialogs. So you can try with something like this (not tested here):

    OnRun()

    WarehouseShipmentLine.SetHideValidationDialog(TRUE);

    WhsePostShipment.SetPostingSettings(TRUE);

    WhsePostShipment.RUN(WarehouseShipmentLine);

    variables:

    Name DataType Subtype Length

    WarehouseShipmentLine Record Warehouse Shipment Line

    WhsePostShipment Codeunit Whse.-Post Shipment

    this kind of simulates the code from codeunit 5764, but instead of asking user if they want to Invoice, you make that choice in your own code. I hope this gets you one step further,

  • ChazKimRP Profile Picture
    ChazKimRP 372 on at
    RE: Suppress Messages during a report i.e Confirmation, Standard Dialog.

    Hello,

    thanks for the response, I am trying to do warehouse shipment batch posting so it would be codeunit 

    5764 i thought. unless I should be using 
    5763
  • Suggested answer
    RE: Suppress Messages during a report i.e Confirmation, Standard Dialog.

    Hi Chaz,

    For sales posting, you could call codeunit 80.RUN (not 81 which is the one called in the UI). And call it with a SalesHeader record, which you first mark with post and / or ship - something like this, done for each record in a loop:

    SalesHeader.Ship := TRUE;
    SalesHeader.Invoice := TRUE;
    SalesPost.RUN(SalesHeader); //SalesPost = Codeunit 80

    Note that on codeunit 80 there are a number of other functions like SetPreviewMode and SetSuppressCommit, that you can call before the posting. These functions take a paramater and store it in a global variable, so if you need to exten this you could add a function to codeunit 80 called "SetShowDialog", and call that. Then amend the code so instead of for example:

    MESSAGE('Posting completed.');

    to

    IF NOT ShowDialog THEN

      MESSAGE('Posting Completed.');

    I hope you see what I mean?

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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans