Secondary pages are modal in that they require some sort of user intervention (e.g. clicking an OK or CANCEL) button before the user can go back to what they were doing. They require some form of user intervention for the user to proceed. This makes them really good for warnings and ensuring the user enters the correct data.

There are three key functions for using modal secondary pages:

  • DoModal to display the secondary modal page
  • IsModal to check if the current page is a modal page
  • EndModal to close a secondary modal page


You can call a secondary page as a push button/hyperlink or you can use the DoModal PeopleCode function.

The basic syntax is: DoModal(PAGE.pagename, title, xpos, ypos, [level, scrollpath, target_row])

For example:

If DoModal(Page.EXAMPLE_PAGE, "Example Modal Page", - 1, - 1) = 1 Then
    /* Do stuff */
    /* Exception */

If using the Peoplecode DoModal function, you need to add a "Secondary Page Control" on the primary (i.e. calling) page, otherwise the OK button won't return you to the primary page.

You can also use a try-catch exception block. The xpos and ypos parameters of -1, -1, centre the modal secondary page.


IsModal is typically used to separate logic for modal pages from that for standard pages. The syntax is just: IsModal(). The function returns either a true if the page is modal or a false if it isn't.


EndModal is only required if your secondary page doesn't already have its own OK and CANCEL buttons, which you specify in the secondary page properties. Sometimes, the delivered OK and CANCEL buttons on a secondary page can misbehave and its better to put your own buttons on there and use EndModal.

The syntax for this function is:


The return value can be either 0 or 1. The 0 acts as the CANCEL button and the 1 as the OK button, so at the end of the PeopleCode for these buttons if you put them manually on your secondary page, put the line EndModal(0); in the CANCEL button PeopleCode and EndModal(1); in the OK button PeopleCode.

As a side note, there are delivered fields OK_BTN and CANCEL_BTN which you should use rather than creating your own - one less customisation that way.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License