Background documentationDefinition as Synchronous or Asynchronous Method (BOR) Locate this document in the navigation structure

 

When deciding whether you want to define a method as synchronous or asynchronous, consider the environment of the subsequent use of the method in a task:

Definition as …

Use

Asynchronous method

A task that refers to an asynchronous object method must be defined with at least one terminating event. If you define an asynchronous method, you must ensure that one of the terminating events is triggered after execution of the method.

At runtime, the relevant work item is only terminated if one of the defined terminating events occurs.

Synchronous method

A task that refers to a synchronous object method can be defined with terminating events.

At runtime, the relevant work item is generally terminated when the synchronous method has been successfully executed. But the work item is also terminated if one of the defined terminating events occurs.

When do you define asynchronous methods?

You define a method as an asynchronous method if you want a task that uses this method to be terminated only via events. The following are possible reasons for defining a method as asynchronous:

The function within the method uses the update task

The method is terminated by an event generated when the update task is successful.

Note Note

If you nevertheless define the method as a synchronous method under these circumstances, the workflow data may be inconsistent with the current data in the database due to update terminations or delays.

End of the note.
The method can also be called outside the workflow

If it is possible that a user may call the function encapsulated in the method outside the workflow although the object is also being processed under the control of a workflow at the same time, you should implement the method as an asynchronous method. It is therefore irrelevant whether calling the function takes place inside or outside the workflow system. The workflow continues after the event occurs.

An asynchronous method with comprehensive functionality is called in the task

This task gets its specific character from the terminating events.

Example Example

In a task, a specific order is to be released for billing. In the task, call the (general) method Process order and enter the event Billing block deleted as the terminating event.

End of the example.
It is also to be possible for the task to be terminated by events not necessarily from method processing

Example Example

The task in which the method Process sales order is executed is also terminated by the event Customer unable to pay.

End of the example.
When do you define synchronous methods?

You define a method as a synchronous method if you want to use the processing results as method parameters or results.

The following are also possible reasons for defining a method as synchronous:

The function within the method does not use an update task
The method is "just" to be executed

Example Example

The method Display for displaying an object.

End of the example.
It is to be possible to call the method several times while the task is being processed

Processing of the task is not completed until the agent sets the processing status to done in their Business Workplace.

Example Example

The method Write letter.

End of the example.
There are no suitable events available

There are no events available that are suitable as terminating events and you have no way of creating the missing events.