A workflow parameter can be used to generate a counter for the number of times a workflow step enters a state.
To build a loop counter using workflow parameters:
From the Workbench shortcut bar, select Configuration > Workflows.
Open a workflow.
The Workflow window opens.
From the Workflow tab, click Add.
The Workflow Parameter window opens.
Type the information as listed in the following table.
In the Parameters section of the Workflow tab, click Add.
From the Workflow tab, click OK.
Create a new immediate SQL execution workflow step.
For details on how to create an SQL execution workflow step, see Creating Execution Workflow Step Sources.
Note about the new step definition:
The result of the SQL execution workflow step returns the result
LOOP_COUNTER + 1.This return value is linked back into the parameter when the workflow step is generated on a workflow.
A validation for a numeric text field is used. This allows you to use <=, <, >=, and > comparisons in transitions off this step.
Add the workflow step to a workflow and choose the new workflow parameter Loop Counter.
By choosing Loop Count, the workflow engine is told to assign the result of "select loop counter val + 1" from dual back into the Loop Counter parameter.
You can now add transitions to and from the new loop counter step. For example, you add the loop counter each time an execution fails. If the execution fails three times, a notification is sent to the user. If the execution fails five times, management is notified.