web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Dialog window in InitProgressWindow method in Sales-Post Codeunit 80

(0) ShareShare
ReportReport
Posted on by 160

Hi there,

I have an extension that's posting sales documents through a scheduled task and I am running into a problem with the Sales-Post codeunit with regards to the Window/Dialog.

The InitProgressWindow contains the code shown below - how do I avoid the code in red raising an error when the Client Type = SOAP, API or NAS, i.e. in instances when the code is executed from a client where the Dialog is not supported without changing this code?

IF PurchHeader.Invoice THEN
Window.OPEN(
'#1#################################\\' +
PostingLinesMsg +
PostingPurchasesAndVATMsg +
PostingVendorsMsg +
PostingBalAccountMsg)
ELSE
Window.OPEN(
'#1############################\\' +
PostingLines2Msg);

Thanks,

Wiechardt

Categories:
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    I've not an environment here to check at the moment but you cannot avoid the dialog if this is the Microsoft's code. Normally you should place IF GUIALLOWED THEN before the OPEN dialog method if you want to use this function in WS or job queue.

    Have you checked if Microsoft do that before calling InitProgressWindow? Something like:

    IF GUIALLOWED THEN

      InitProgressWindow

    ELSE

    ...

  • Wiechardt Brummer Profile Picture
    160 on at

    Hi Stefano,

    Thanks for your response.  

    The method/code calling the InitProgressWindow does not have a IF GUIALLOWED check but the good news is, for some reason, the document does indeed get posted even with this code in place.  I guess Microsoft built in some underlying logic to suppress dialogs when the code is executed in the context of NAS/SOAP/API.

    Regards,

    Wiechardt

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans