OutSystems Platform allows you to implement server-side logic using C# or Java. This allows you to leverage existing libraries and SDKs.

To use your own C# or Java code:

  1. Create a new Extension module;
  2. Define the Actions that will encapsulate your C# or Java code;
  3. Generate the stubs for the declared actions;
  4. Code the logic of the actions using your favorite IDE;
  5. Publish the Extension module;
  6. In your OutSystems applications, create a dependency to the new extension and use its actions in your logic.


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.

Create an Extension and Its Actions

To start reusing your code, you need to create a new Extension module:

  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.

Code and Publish the Extension

Now that we've defined the signature of the action, we need to code its logic, and make it available to reuse. Click 'Edit Source Code .NET' or 'Edit Source Code J2EE'. It will automatically generate the stubs for the actions and open the corresponding IDE;

Now we can implement and test the code as usual.



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

Use an Extension in Your Application

Once you've published your extension, you can use it in your OutSystems applications:

  1. In your application, click 'Add/Remove Dependencies', and pick the 'CalculateMortgage' action. Learn how to add a dependency;
  2. Call the extension action in your logic. In this example we call it after validating the end-user input.

See Also

Connect to an External Database | Use Extension Actions and Structures