Give us feedback
Reactive icon


Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded on 07 September 2022 by 
 (3 ratings)


StateMachine is a combination of States and Decision-Making Logic based on which the status of a request or case is changed. It has predefined source and target states. This Sample application can be used as a Demo or Boilerplate with minimal changes.
Read more
StateMachine is a combination of States and Decision Making Logic based on which the status of a request or case is changed. It has predefined source and target states.

Below given is the process flow that is implemented in this demo using StateMachine 

Three Core Entities are used to Acheive the StateMachine.
1) Status
2) Action
3) Event History
4) Request

Status is a Static Entity which provides the list of statuses used to transition the Requests from Start to Finish
The Primary Key Id of the Status entity is not set to auto-number to prevent the change of ID value during Migration

There is a RequestStatus reusable web block to show the status of each request. We have 2 Color attrubutes in the Status entity to provide the Status Color and the Text Color

Action is a static entity that provides list of actions performed by user in the screen like Approve, Reject, Rerun, Confirm etc.
Based on the current request status,  relevant buttons are provided in the screen for the users to perform applicable actions.

Event History
Event history is an entity is like an audit table to save all the actions and status changes performed by used for each request.

Request is a Business entity to store the request related data and it has the reference to Status Entity.

Server Actions
The following are the actions used in the application
1) CreateEvent
2) CreateRequestWrapper
3) Update_RequestStatus
4) UpdateRequestWrapper
5) StateMachine_BL


Create event action is called when some action has been performed in the screen and a record need to be inserted into EventHistory entity.

A wrapper action to create new record in the Request entity with the submitted data.
A wrapper action to update an existing record in the Request entity with the submitted data. In this demo application, users are allowed to update only when the request is returned by the Reviewer.

A wrapper action to update status of the request. As and when the user perform an action like approve, reject, or confirm, the current status of the request id in question will be updated to the new status received as input. 

A Server action with business logic to handle the StateMachine.
The Switch in the action decides the next status based on the following parameters
1) Current Status
2) Current User's Role
3) the Action performed in the screen (button clicked in the screen)

Roles has to be defined based on the personas
In this demo we have 3 roles
1) Requester
2) Reviewer
3) Approver

Following are the screens needed to implement a simple StateMachine
1) Requests
2) RequestDetail
3) Tasks

Screen to display requests raised by the user.

2 Types of list are displayed in the screen.
1) Requests raised by self
2) Self requests returned by the reviewer

Screen to display the Tasks that are assigned to Reviewers and Approvers.
Reviewers get to see 2 list
1) New Requests Submitted by Requester
2) Returned Requests resubmitted by Requester

Approvers get to see 1 list with reviewed requests from Reviewers.

A Screen to view the details of the selected requests and perform some action on the request.
The list of actions that can be performed in the RequestDetails Screen are
1) Confirm
2) Return
3) Approve
4) Reject
5) Complete
6) Save
7) Submit
8) Back

Requester can create a new request (save), resubmit a returned request (submit), close a request after approver approves the request (Complete)  or go back to the previous screen (Back)
Reviewer can review the request and send to Approver (confirm), return the request back to requester (return) or go back to the previous screen (Back)
Approver can approve the request and send to Requester (Approve), reject the request (reject) or go back to the previous screen (Back).


For now there is only one web block used in the Demo.
RequestStatus is a block with tag to display the status of each request.
Status Label, Status Color and Text Color are the inputs.

Release notes (1.0.0)
Reviews (1)
in version 1.0.0
Thank you for the brief documentation!