Custom action decorators

4min

A decorator is a structural pattern that allows adding new behaviors to objects dynamically by placing them inside special wrapper objects. Using decorators you can wrap both objects and decorators because they follow the same interface.

To assist users in creating their own custom actions Procesio  has made available on Github a Action Core library that allows you to make use of both frontend and backend decorators. 

The correct use of decorators is mandatory in order for your custom actions to be accepted by the platform, a simple implementation of a custom action is explained here.

The first decorator that you will use must be the class decorator, this attribute is used to define some basic information about the action.

C#


If you will need to test the action with a test value, for example if a string has any characters you could use string.IsNullOrEmpty inside a custom action and the result will be added inside a Boolean. The class decorator property that will be used is IsTestable:

C#


Frontend decorators are responsible of creating the visuals of the action with which you will interact in the platform, visuals like the Modal, input tabs, checkboxes whose position and order can be controlled with the use of RowId. The full list of frontend decorators and their use can be found here.

C#


Backend decorators provide information on how the data will be used inside the platform showing the direction of the data.

C#

C#


The validator decorator describes the conditions that need to be respected, conditions like the data type or if it is mandatory.

You can find a more complex example of how to use decorators here.