--- title: "Create a custom codeunit with expression functions" slug: "bc-create-a-custom-codeunit-with-expression-functions" description: "Extend Business Integration Solutions in Dynamics 365 with custom functions for MAPPER activity. Learn to develop and register codeunits effectively." tags: ["BC", "BIS", "Business Central", "Business Integration Solutions", "Task"] updated: 2026-06-25T12:23:08Z published: 2026-06-25T12:23:08Z canonical: "docs.staedean.com/bc-create-a-custom-codeunit-with-expression-functions" --- > ## 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 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] > **Note** > > The SaaS version has a different interface that will become available later in the on-premise version. See [here](/business-central/docs/bc-expose-functions-to-the-function-interface) 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] > **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] > **Note** > > If no functions appear during registration, the App source files may be protected and Business Integration Solutions cannot parse them. See [Initialize BIS](/business-central/docs/bc-install-and-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: ```plaintext 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; ` ## Related - [Install and initialize Business Integration Solutions](/bc-install-and-initialize-bis.md) - [Expose functions to the Function interface](/bc-expose-functions-to-the-function-interface.md) - [Expression function](/bc-expression-function.md)