Business Integration Solutions Saas

How To: Expose functions to the Function Interface

Usage

Use this task when you want to extend the solution with custom functions for use in expressions. These functions are developed in standard AL code, with the familiar constructs for table access and calculations.
Typically one would use the arguments that are passed in to query data from the Business Central database and then calculate a return value. The functions can only use base types for arguments and return value. The functions should be side-effect free.

Prerequisites

The following prerequisites are required

  • Experience in developing in Business Central AL
  • Understanding of Business Integration Solutions and especially the mapping of documents
  • A development license

Steps

  1. Create a custom codeunit with functions or use a pre-existing codeunit one or more functions in it (These can be from an On Premise targeted environment ).
  2. Create a dependency on _Exclude_TI-Common to expose the API.
  3. Either create the codeunit yourself (example below) or use an existing codeunit
  4. Implement at least one of the following interfaces
  5. Compile, publish and install your app

Afer installing your app, an additional set of functions becomes available for use in expressions. In case the new functions are not available in the function list in the Expression wizard, a refresh option is available. This action will update the internal library with the new functions.

Conversion

A conversion tool is available that converts codeunit source files and adds code to expose the functions in the codeunit to the NamespaceInvokable Interface This is available on the Function Library page

We strongly recommend to use the same ID for the enumvalue as the CodeunitID: this will allow Expressions used in On Premise versions, to be used on SaaS without the need to convert these.

Steps

  1. Click on <Convert AL Codeunit>, a popup will display requesting for the On Premise codeunit to be uploaded
  2. Once the codeunit has been uploaded, the system will convert it to use the SaaS version of function handling
  3. A confirmation message will be displayed, in which you also get a small snippet of code that needs to be added to your own extension of enum "TICNSInvokable"
value(codeunitID; CodeunitName)
{
   Implementation = TICINamespacedInvokable = CodeunitName, TICIInvokeRegistrable = CodeunitName;
}

Function Library Page