Via the WaitForCondition system function, a work item waits for another work item that meets a specified condition. This functionality can be useful in workflows that require information from outside the main processfor example, a loan approval process that is dependent on verification of the applicant's employment. (One work item represents the loan application, another represents the employment verification.)
When you include WaitForCondition in a step, you specify criteria of the work items(s) to wait for. The criteria include a workflow definition name and an identifying value (such as the applicant's Social Security number). While only one work item can satisfy the WaitForCondition at runtime, you can enter multiple criteria if the waited-for work item can be one of several different work items.
When WaitForCondition executes, Process Engine (PE) checks the system for a work item that matches the specified criteria. If no existing work item meets the condition, the waiting work item is moved to the Delay system queue and the search for a matching work item continues as follows:
Checking continues until a match is found or until the specified timeout period expires. If multiple work items meet the match criteria, the work item with the oldest date/time stamp satisfies the wait condition. A single work item can satisfy multiple waiting work items; a work item has no knowledge of being waited for.
When a matching work item is found or the timeout period expires, a data field in the waiting work item is updated to indicate the result of the wait (that is, whether it was satisfied or timed-out). Also when a matching work item is found, any optional actions you designated occur; these actions can include:
After these actions occur, processing for both (waiting and waited-for) work items continues as specified on their workflow maps.