Wait stage

In Object Studio, a Wait stage allows you to pause the execution of a business object until a certain condition has been met in the target application, and you can then branch the flow of your business object depending on the outcome. This is carried out using a Time Out stage, which is similar to the Otherwise stage of a Choice stage.

The business object can wait for one of several different outcomes to occur. For example, after committing new data, a pop-up window or error message could appear, or a different event may occur. You can design the business object so that if no change is detected, it will continue to execute after the specified timeout period.

You can use a Wait stage to:

  • Detect readiness for interaction — A Wait stage can be used to make sure that the target application is ready. For example, after launching the application it may be necessary to wait for it to finish loading. This could be achieved by waiting for the main application window to become visible. Or, it might be necessary to wait for a system idle message in the status bar before submitting new data. This could be achieved by waiting for the status bar text to read system idle.
  • Detect the outcome of an action — When multiple condition checks are made, the flow of the business object can be branched, depending on which outcome occurs first.

Properties form

The Actions list in the Wait Properties form displays the conditions to be checked by the Wait stage.

The checks are performed in order, from top to bottom, so you must add the conditions in the correct order. For example, the first condition might be: Check whether a 'save as' dialog exists, the second condition might be: Check whether an error message window exists.

When one of the conditions is met, the business object follows the corresponding branch on the process diagram. There is one branch per condition, and the branches appear on the diagram in the same order as the conditions in the list. If none of the conditions are met, the checks begin again from the first row. This looping continues until either a condition is met, or the timeout period elapses.

Each wait condition consists of:

  • Element — The application element is the target of the condition, for example, that the specified application window exists.
  • Condition — Describes which state is to be checked against that element, for example, CheckExists, GetWindowText.
  • Type and Comparison — Describe how the value supplied should be compared to the data found in the target application. This may be to detect whether the data is equal or unequal, whether it matches a wildcard pattern, or to see if one value is larger than another, for example, in the case of numbers.
  • Value — The expected value that is used in the comparison.

Add a wait condition

  1. Click Add.

    A new row is added to the Actions list.

  2. Drag and drop an application element from the Application Explorer into the Element field.

  3. If the match type of the application element was set to Dynamic when it was created, you must click the ... (ellipsis) in the Params field to supply parameters to the application element. This allows the element to be identified when your business object is run as part of a process. See Element parameters for more information.

    The button is only available when the match type of the application element is Dynamic.

  1. Select a Condition from the drop-down list. This list varies dynamically according to the type of application element selected. If a condition does not appear in the list, then it cannot be checked against the selected application element.
  2. Optionally, in the Type field you can enter a custom comparison type, for example to perform a wildcard pattern match. However, in most cases it is likely that you will want to use the default comparison type, which is a test for equality.
  3. In the Value field, enter the expected value. For example, for CheckExists, the value will be either True or False, and for GetText, the value will be the expected text. The value entered here must match exactly for the condition to match exactly.
  4. Specify a timeout period for the Wait stage.

Specify a timeout period

Enter the length of the timeout for the Wait stage in the Timeout (timespan/secs) field. This can be a numeric value which is the maximum amount of time in seconds that the Wait stage will keep checking for one of the conditions to be met. Alternatively, you can enter an expression in the field. Using an expression enables you to store a global timeout value in a data item and reference this data in all your Wait stages.

If none of the conditions are met after the timeout period has elapsed, then the business object flow follows the link from the Time Out stage on the process diagram. If no such link exists then the business object stops with an error.