Wait For Event

Use the WaitForEvent function to have the automation logic wait for a specific event to occur and then proceed with downstream automation logic. This function changes event to act as a method which requires triggering from upstream automation logic. Once the WaitForEvent is triggered, it triggers the Setup event port which you connect to the initiating logic (the logic that cause the event to occur). Once the event occurs, the Fired event port is fired which you can use to trigger downstream automation logic you want to occur after the event.

For example, suppose you are creating a project which integrates a Windows application, where normally a user clicks a Get Records button to retrieve a large number of records. Another button on the form, Filter Records, does not become enabled until all of the records have been retrieved.

In automating this process, the Studio automation logic calls the PerformClick method on the Get Records button. The only way the project is alerted that the all records have been retrieved is when the Filter Records button becomes enabled. Once the Filter Records button is enabled, the next step in the application automation can occur (for example, calling the PerformClick method on the Next button to filter the records.

In this case, using the WaitForEvent function on the Filter Records Button.Enabled event would provide the required automation flow.

  1. Add the btnFilterRecords.EnabledChanged event added to the automation.

  2. Right-click on the btnFilterRecords.EnabledChanged connection block and select WaitForEvent, as shown in this example.

  3. The event connection block now looks and acts like a method. Trigger the WaitForEvent using upstream automation logic.

  4. Use the Setup output event to trigger the PerformClick method for the Get Records button. The Setup output must initiate the actions that cause the event you are waiting for to be raised (in this case, the Clicking the Get Records button which retrieves the records and then changes the enabled state of the Filter Records button.

  5. Once the event you are waiting for occurs (in this case, the Filter Records button enabled state changes, the Fired output is triggered. You can then connect this output port to the downstream automation logic.

 


Privacy | Trademarks | Terms of Use | Feedback

Updated: 18 June 2020

© 2016 - 2020 Pegasystems Inc.  Cambridge, MA All rights reserved.

 

OpenSpan data classification label