The On Open action is an activity callback action that allows you to design business rules to validate whether an instance of a process activity (in the process flow) can be opened by the end-user, that is to say, whether the activity can be executed by the end-user. An On Open action can have local variables.

If you want to stop the end-user from opening a task in the Taskbox, raise an exception using the Raise Exception element. This will prevent the process activity from moving to the open state and will keep it in its current state. Learn more about how to Explicitly Raise an Exception.

Input parameters

None

Output parameters

None

Example

As an example, think of an application to request IT resources to an help desk. When someone at the help desk opens the task to deliver the resource, if the resource is not currently available an exception is thrown keeping the process instance in the Ready state. Only when the resource being requested is available, it is possible to open the task from the task box.

In these Scenarios you should use the Abort Activity Change Exception. Once this exception is raised, it is logged in Service Center under the general log. All other exceptions are logged under the error tab.

Remark

Asynchronous logic such as Timers and Process Activities run on a separate session, meaning that session variables will have their default value.

The OnOpen callback activity is the only exception: before executing the OnOpen, the OutSystems Platform copies the value of the UserId session variable from the session of the user that opened the activity in the task box, to the session executing the process activities.

This allows you to implement custom logic, for example to maintain a log of all users that opened a specific task, or implement dynamic permission validation.

See Also

Process Activities Callback Actions | Process Activities Life Cycle | Process Callback Actions | Explicitly Raise an Exception | Designing Actions | Designing Processes | Process Flow Toolbox