Background activity (background process) is used for processes taking extended period of time. It does not prevent to continue the work and provides the activity ID, on which you can get information about the processes happening in this activity (for example, the progress bar in %). Also it lets to interrupt it or give an interactive answer to the operator’s question arising during the process.

Background activity is identified by two values: type and ID. All methods, that trigger the background activity (usually starting on Run*), return this particular pair of values – type and ID. And all methods working with the activities, accept these two values.

How to find background activity

SearchBackgroundActivities method is using to find background activity. It’s necessary to let you know what’s going on in the system.

Accepts activities search options, which can be, for example, restrict certain types of activities. Particularly there is no need to display in Autorepayment interface activities which are not related to it.

For a simple receiving all activities you can pass

<BackgroundActivitySearchParameters></BackgroundActivitySearchParameters>

 

Returns list of background activities, with brief information about them. In brief information (BackgroundActivityInfo) it is possible to immediately find out everything you need, except the list of activity steps. More info about the basic properties of the activity you can read below.

How to get information about background activity

GetBackgroundActivityInfo method is used for getting background activity. It’s necessery to show the process which is happens in this activity.

Accepts type and ID of the background activity.

Returns total information about the background activity and the process of its implementation (BackgroundActivityFullInfoAnswer). Brief description of the properties can be found in Manuals by the link, and most valued properties are described here.

Main properties of background activity

IsAwaitingAction

If this property is equal to “true”, the activity is suspended and waiting for action from the user. You should take this into account, because activity will not continue without action.

Actions

The list of actions that user can execute in activity immediately. Each action has name and ID. Action ID should be transferred to DoActionForBackgroundActivity method. It always has  canceling action of activity itself (Cancel), and other actions may occur during the activity work.

Steps

The list of activity steps, showing the process flow. Every step (BackgroundActivityStepInfo)  consists of step type (information, error, warning, question, etc.,which can be used, for example, to highlight relevant line for operator), step text and step action list. “Question” type usually describes the issue to operator and lead to the suspension of the activity pending the reactions.

Action of step ­­– (BackgroundActivityStepActionInfo) is concept separate from the actions activity. Actions of step never suspend activity, but allow to perform something in the context of situation described by this step.

For example, if in orders linking process wasn’t found full compliance for any product, the warning message will contain actions for any linking with any product, if the operator will find it necessary. The operation is possible with   DoStepActionForBackgroundActivity method.

Action of step contains ID, name and parameter set. The system which operates with activities, should run through ID and do something when selecting an action on the basis of ID. If ID is equal to “DoStepAction”, it’s possible to perform the action by calling DoStepActionForBackgroundActivity method.

All other action IDs system processes on its own, they can not be met by ordinary OT API calling.

How to perform action for background activity

When background activity expects necessary action, DoActionForBackgroundActivity method performs this action for background activity (in fact, it answers the question to continue process).

Accepts type and ID of background activity and action ID. Available actions can be found from  “Actions” properties of activity information.

Returns nothing but errors, if there are any of them.  

How to perform step action for background activity

DoStepActionForBackgroundActivity method is used for it.

Accepts type and ID of background activity, as well as set of action steps parameters

All the parameters of the respective step action info, given in “Parameters” setting, must be transferred completely without adding or removing anything.

Returns nothing but errors, if there are any of them.  

  • Нет меток