Documentation Index

Fetch the complete documentation index at: https://docs.staedean.com/llms.txt

Use this file to discover all available pages before exploring further.

Create a custom codeunit with expression functions

Prev Next

Use this task to extend Business Integration Solutions with custom functions, for example, for use in the MAPPER activity.

Prerequisites

The following prerequisites are required:

  • Experience developing in Microsoft Dynamics 365 Business Central AL.

  • Understanding of Business Integration Solutions and especially document mapping.

  • A development license.

Note

The SaaS version has a different interface that will become available later in the on-premise version. See here for more information.

Steps

  1. Develop a custom codeunit with functions. 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 Microsoft Dynamics 365 Business Central database and calculate a return value.

    Note

    Functions can only use base types for arguments and return values. Functions should be side-effect free.

  2. Add comments to the functions indicating category and description. Business Integration Solutions interprets these comments during registration. The category and description appear in the mapping wizard.

  3. Compile the codeunit.

  4. Register the codeunit in Business Integration Solutions. The Application Setup menu contains a Function Library page. From the ribbon on this page, select Register to register a codeunit. Select the codeunit from the list and import it into the system. The set of available functions extends with the functions in the selected codeunit.

    Note

    If no functions appear during registration, the App source files may be protected and Business Integration Solutions cannot parse them. See Initialize BIS.

An additional set of functions becomes available for mapping.

Example

The following function is defined in the Business Integration Solutions standard function library:

procedure XCOPYSTR(String : Text;Position : Integer;Length : Integer) : Text
begin
  //**********************************************************
  // category : string
  // description: Copies a substring of 

Anywhere Mobility Solutions length from a specific position in a string (text or code) to a new string.   //**********************************************************   EXIT(COPYSTR(String,Position,Length)); end;