Skip to main content

Developing an Application

 

OutSystems

Code Reusability and Modularity

When developing your applications in OutSystems, elements are implemented and reused anywhere inside a module. However, some elements can be exposed to be reused in other modules. This allows having modules that implement and expose specific functionality (elements) and build modular applications.

In OutSystems, the module that implements and exposes elements is called the Producer module. On the other hand, a module that reuses exposed elements is called the Consumer module.

Elements that are created in modules are not exposed by default. To do that, use their Public property. In the case of extensions, all their elements are exposed.

For a module to reuse elements exposed by other modules or extensions, go to that module and use the Manage Dependencies window to select the elements. They will become available to be used as any other element in the module.

Consumer modules cannot modify elements they are reusing from other modules. That is only possible in the modules where the element is implemented and exposed (Producer modules). Once modified, it will have impact on Consumer modules. See more about how to update code reused between modules.

Elements that Can Be Exposed

The following table constains all elements that can be exposed by a module:

Tab Element More details
Interface Web Screen
Web Block Read more
Theme Read more
Image
Logic Action Read more
Role Read more
Data Entity Read more
Structure Read more
Processes Process Read more
Process Activity Read more

Exposed Web Block

A Web Block cannot be exposed when:

  • It has a parameter that is defined using an Entity/Structure that is not exposed;

  • It has a parameter that is defined using an Entity/Structure that is reused from another module;

  • It contains a Link widget, Button widget, or a consumed Web Screen with arguments of Binary Data, Record, or List data types.

When executing an exposed Web Block, data is handled between the modules under the same context, i.e., the same database, same session variables, same site properties, etc. However, the execution runs under the transaction of the Consumer module.

In case the execution of the Producer and Consumer modules are under different User Providers, the modules have different sessions. In this case, variables associated to the session can hold different values between modules.

Exposed Theme

A Theme cannot be exposed when:

  • It has a Web Block with a parameter that is defined using an Entity/Structure that is not exposed;

  • It has a Web Block with a parameter that is defined using an Entity/Structure that is reused from another module;

  • It contains a Link widget, Button widget, or a consumed Web Screen with arguments of Binary Data, Record, or List data types.

Exposed Action

An Action cannot be exposed when:

  • It has a parameter that is defined using an Entity/Structure that is not exposed;

  • It has a parameter that is defined using an Entity/Structure that is reused from another module.

When executing an exposed Action, data is handled between the modules under the same context, i.e., the same database, same session variables, same site properties, etc. However, the execution runs under the transaction of the Consumer module.

In case the execution of the Producer and Consumer modules are under different User Providers, the modules have different sessions. In this case, variables associated to the session can hold different values between modules.

The above behaviors apply to exposed Actions that are set as functions.

Exposed Role

When an exposed Role is checked, it raises an exception under the transaction of the Consumer module.

Exposed Entity

When executing Entity Actions (Create, Update, CreateOrUpdate, ...) of an exposed Entity, data is handled between the modules under the same context, i.e., the same database. However, the execution runs under the transaction of the Consumer module.

An exposed entity can have its records protected from being modified by setting the entity's Expose Read Only property to 'Yes'.

Exposed Structure

A Structure cannot be exposed when:

  • It has an attribute that is defined using an Entity/Structure that is not exposed;

  • It has an attribute that is defined using an Entity/Structure that is reused from another module;

Exposed Process

When executing an exposed Process, data is handled between the modules under the same context, i.e., the same database, same session variables, same site properties, etc. However, the execution runs under the transaction of the Consumer module.

Exposed Process Activity

A Process Activity cannot be exposed if their Process is not exposed or the module is Multi-tenant

Process activities that can be exposed are:

  • Human Activity;
  • Wait;
  • Conditional Start.

Consumer modules can only handle Process Activities through Process Activity system actions. They cannot reuse Process Activities in flows.

  • Was this article helpful?