You can use dynamic timeouts in wait activities and in the timeout element of a receive choice activity. In both cases, you can specify either a period of time or an expiration date. These options will be explained in the next two chapters.
Time period
To specify a time period for a timeout in a receive choice activity or for a wait activity in Java code, complete the following steps:
- In the business process editor, click the Timeout element or the Wait activity.
- In the properties view, click the Details tab.
- For Expression language, select Java.
- Click Duration.
- For Expression Type, select Java.
- If the Question dialog appears, click Yes.

- In the text area, enter the Java code.
- On the toolbar, click the Save button
.
The following image shows the timeout of this sample:
Note: the return value of the java snippet is interpreted as seconds.
Expiration date
To specify a dynamic expiration date for a timeout in a receive choice activity or for a wait activity with an XPath expression, complete the following steps:
- For your business process specify a variable of type dateTime.
- In the business process editor, click the Timeout element or the Wait activity.
- In the properties view, click the Details tab.
- For Expression language, select XPath 1.0.
- Click Date.
- For Expression Type, select Text.
- In the text area, enter the expression. If you want to set the value from the variable specified in step 1, you can use the following XPath extension:
bpws:getVariableData('variable name')
- On the toolbar, click the Save button
.
The following image shows the WaitUntilAppointment activity of this sample: