Skip to main content

Extensibility and Integration

 

OutSystems

Extend Your Logic with .NET or Java Code

When developing your app, you might want to leverage existing libraries and SDKs or reuse your own C# or Java code as opposed to reproducing the functionality that code provides using OutSystems Logic.

OutSystems allows you to implement server-side logic using C# or Java.

To create an Extension:

  1. In Integration Studio, click New to create a new Extension module;

  2. Select the Application Server where to publish your extension later;

  3. Right-click the Action folder to define the new actions that will encapsulate your C# or Java code;

  4. Define any input and output parameters for your action(s);

  5. Generate the stubs for the declared actions;

  6. Code the logic of the actions using your favorite IDE;

  7. Publish the Extension module.

To use the created extension, for each of your OutSystems applications where you want to use the new extension, add the extension module as a dependency. Once the extension module is a dependency of your application, the logic the module implements becomes available in the Logic tab of the Development Environment.

Example

In this example, we already have a C# and a Java method that calculates the monthly payments for a mortgage. Instead of implementing the same method from scratch using OutSystems logic, we'll encapsulate that method into an Extension module.

To create the Extension module, do the following:

  1. Add a new module to your application, and choose New Extension Module... template;

  2. Name your module MortgageLib;

  3. In Integration Studio, in the Actions folder, create a new CalculateMortage action;

  4. Define the CalculateMortage action signature as displayed in the image below.

    Integration Studio, creating a new extension

  5. To make the action available for reuse, click Edit Source Code .NET' or Edit Source Code J2EE. This will automatically generate the stubs for the actions and open the corresponding IDE;

  6. Implement and test the code.

    Implementing logic with C#

    C# Example

    Implementing logic with Java, example

    Java Example

  7. Once you finish coding, go back to Integration Studio and click on 1-Click Publish, or use F5 to deploy your extension.

 

To use the new extension in your application:

  1. From your Application's detail screen, click on Add Dependency;

  2. From the Manage Dependencies window pick the CalculateMortgage action;

  3. Call the extension action in your logic. In this example, we call it after validating the end-user input.

    Using action(s) in the extension module; editing an action flow in the development environment

  • Was this article helpful?