Use of RUN and RUNMODAL in Business Central

Use of RUN and RUNMODAL in Business Central:

(1) In D365 BC there are two functions:

  • RUN
  • RUNMODAL

(2) Both functions are used for running the objects (Reports, Pages &Codeunits).

(3) The basic used and differences between RUN and RUNMODAL are that, The first is that with RUNMODAL execution of the calling object is stopped until it has finished. With RUN both objects execute at the same time, so with RUNMODAL, you cannot switch to the calling form until the form you are working on is closed. The second is that the instance of the object is destroyed when RUN is called but not when RUNMODAL is called. This means that you can return values from an object with RUNMODAL but not with RUN. As the instance of the object is preserved with RUNMODAL then you should be careful when you call an object with RUNMODAL more than once as its global variables will still be set to the values of the previous execution.

(4) SYNTAX of RUN and RUNMODAL:

  • Page.Run(): Creates and launches a page that you specify. You can use CLEAR method to remove the page.
  • Page.RunModal(): Creates, opens, and closes a page that you specify. When a page is run modally, no input, such as a keyboard or mouse click, can occur except for objects on the modal page.
  • Report.Run(): Loads and executes the report that you specify.
  • Report.RUNMODAL: Loads and executes the report that you specify.
  • REPORT.RUNMODAL(Number [, ReqWindow] [, SystemPrinter] [, Record]): Loads and runs the report that you specify. The report is run modally.
  • Codeunit.RUN(Number[, Record]): Loads and executes the unit of C/AL code that you specify.
  • Codeunit.RUN(VAR Record): Loads and executes the unit of C/AL code you specify. To use this function, you can specify a table associated with the codeunit when you defined the codeunit properties. This allows you to pass a variable with the function. The transaction that the codeunit contains is always committed due to the Boolean return value.

Use of STRMENU function in D365 BC
Automatic Posting of Return Receipt at the time of Sales Credit Memo Posting
Create or Setup Sandbox Environment in D365 BC
Restore and Change in Pages by using Personalize in BC D365
Page.RunModal() Method– Microsoft Docs

Leave a Reply