Monday, October 12, 2009

Is MessageBox a Think-Time Function?

Think-time functions are PeopleCode functions that suspend PeopleSoft processing to wait for an external event (user input, an external process to complete etc). PeopleBooks strongly recommends not using think-time functions in certain PeopleCode events.

However, what category does MessageBox fall into? Well according to PeopleBooks:

If the style parameter specifies more than one button, the function behaves as a think-time function and is subject to the same restrictions as other think-time functions.

In other words, MessageBox is not a think time function when the style parameter only specifies one button! This can only be the case when the style parameter is 0 or %MsgStyle_OK which means only show the OK button. So if you use 0 or %MsgStyle_OK as the style parameter, you can use MessageBox as a normal function in any relevant PeopleCode event.

1 comment:

  1. If you are using the MessageBox function to display a message catalog entry with bind parameters (e.g. bind variables %1, %2, %3) then it will behave as a think-time function even though you might be using a style parameter of 0 or %MsgStyle_OK. Note that the style parameter is the first parameter passed to the MessageBox function.

    So only the simplest OK message box with no bind parameters doesn't behave as a think-time function.