Business Integration Solutions SaaS
How to: Expose functions to the Function Interface
Usage
Use this task to extend the solution with custom functions for use in expressions. Write the functions in standard AL code using familiar constructs for table access and calculations. Typically, use the arguments passed in to query data from the Business Central database and calculate a return value. Functions can only use base types for arguments and return values. Functions must be side-effect free.
Prerequisites
The following prerequisites are required:
- Experience developing in Business Central AL.
- Understanding of Business Integration Solutions and especially document mapping.
- A development license.
Steps
- Create a custom codeunit with functions, or use an existing codeunit with one or more functions.
- Create a dependency on
_Exclude_TI-Commonto expose the API. - Either create the codeunit yourself (see example below) or use an existing codeunit.
- Implement at least one of the following interfaces:
- Compile, publish, and install your app.
After installing your app, an additional set of functions becomes available for use in expressions. If the new functions do not appear in the function list in the Expression Wizard, a refresh option is available. This action updates 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 to the NamespacedInvokable interface. This tool is available on the Function Library page.
We strongly recommend using the same ID for the enum value as the codeunit ID. This lets expressions used in on-premise versions work on SaaS without conversion.
Steps
- Select Convert AL Codeunit. A popup appears requesting the on-premise codeunit to upload.
- Once the codeunit uploads, the system converts it to use the SaaS version of function handling.
- A confirmation message appears. It includes a small snippet of code to add to your own extension of enum
TICNSInvokable:
value(codeunitID; CodeunitName)
{
Implementation = TICINamespacedInvokable = CodeunitName, TICIInvokeRegistrable = CodeunitName;
}
