--- title: "Expression function" slug: "bc-expression-function" description: "Learn how to use Expression Functions in mapping, extend standard expressions, and register custom codeunits for advanced calculations in Business Central." tags: ["BC", "BIS", "Business Central", "Business Integration Solutions", "Task"] updated: 2026-06-25T07:53:41Z published: 2026-06-25T09:59:17Z canonical: "docs.staedean.com/bc-expression-function" --- > ## 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. # Expression function An Expression Function lets you call Microsoft Dynamics 365 Business Central functions from a mapping. Business Integration Solutions provides a collection of standard expressions that you can easily extend with custom functions. Add new expression functions in a custom codeunit. You cannot modify the standard expression functions. Expression functions execute in the context of the mapping. Use the mapping wizard to map the arguments of a function with the appropriate values. To use expression functions in the **Mapping Wizard**, register the expression codeunit in the **Function Library**. The registration function verifies the codeunit and extracts the metadata from the object. Examples of expression functions include GLN number conversions, item inventory calculations, and advanced date and time manipulations. > [!NOTE] > **Note** > > A return value is not required to register a function, though functions without a return value are not suitable for [Mapping](/business-central/docs/bc-expression-functions-mapping). ## Format Expression functions have the following format: ```plaintext Codeunit:.() ``` - **Operator:**`Codeunit` - **ID:** Depending on the implementation, the ID refers to either the codeunit ID or the enum ID, depending on the interface. See [Expression function, on-premise vs SaaS](/business-central/docs/bc-expression-function#onpremise-vs-saas). - **FunctionName:** The name of the function. - **(Arguments):** A list of arguments, separated by commas. ## Standard expression functions The following list shows the standard functions available in Business Integration Solutions for Microsoft Dynamics 365 Business Central. The functions from Business Integration Solutions register via codeunit Business Integration Solutions Function List 2, which registers during product installation. | Method name | Description | Arguments | | --- | --- | --- | | [XWORKDATE](/business-central/docs/bc-function-list#xworkdate) | Gets the work date for the current session. | : | | [XUPPERCASE](/business-central/docs/bc-function-list#xuppercase) | Converts a string to uppercase. | String (text) | | [XTODAY](/business-central/docs/bc-function-list#xtoday) | Gets the current date set in the operating system. | : | | [XTIME](/business-central/docs/bc-function-list#xtime) | Gets the current time from the operating system. | : | | [XSTRRIGHT](/business-central/docs/bc-function-list#xstrright) | Copies a number of characters from the right side of a string. | String (text), Length (integer) | | [XSTRLEFT](/business-central/docs/bc-function-list#xstrleft) | Copies a number of characters from the left side of a string. | String (text), Length (integer) | | [XSELECTSTR](/business-central/docs/bc-function-list#xselectstr) | Retrieves a substring from a comma-separated string. | String (text), Separator (text), Place (integer) | | [XLOWERCASE](/business-central/docs/bc-function-list#xlowercase) | Converts a string to lowercase. | String (text) | | [XDELCHR](/business-central/docs/bc-function-list#xdelchr) | Deletes one or more specific characters in a string. | String (text), Where (`=,<,>`), Which (char) | | [XCOPYSTR](/business-central/docs/bc-function-list#xcopystr) | Selects a substring from a specific position in a string. | String (text), Position (integer), Length (integer) | | [XCOMPANYNAME](/business-central/docs/bc-function-list#xcompanyname) | Gets the current company name. | : | | [XCALCDATE](/business-central/docs/bc-function-list#xcalcdate) | Calculates a new date based on a date expression and a reference date. | [DateExpression](/business-central/docs/expression-function#references) (text), Date (date) | | [ParseDate](/business-central/docs/bc-function-list#parsedate) | Parses an external date format into a Date. | Date (text), .NET date format | | [FormatDecimal](/business-central/docs/bc-function-list#formatdecimal) | Formats a decimal to a different format. | Decimal (text), [FormatExpression](/business-central/docs/expression-function#references) | | [FormatDate](/business-central/docs/bc-function-list#formatdate) | Formats a Date to a different format. | Date (text), [FormatExpression](/business-central/docs/expression-function#references) | | [ConvertToInternal](/business-central/docs/bc-function-list#converttointernal) | Applies a conversion table on an external value. | ConversionTableCode (code), ExternalValue (string) | | [ConvertToExternal](/business-central/docs/bc-function-list#converttoexternal) | Applies a conversion table on an internal value. | ConversionTableCode (code), InternalValue (string) | | [Base64Encode](/business-central/docs/bc-function-list#base64decode) | Encodes a string to a base64 value. | String (text) | | [Base64Decode](/business-central/docs/bc-function-list#base64encode) | Decodes a base64-encoded value to a string. | Base64String (text) | | [XIF](/business-central/docs/bc-function-list#xif) | Returns a Boolean value based on a logical test and optional datatype. | iTxtValue (Text), iTxtLogicalTest (Text), TxtDataType (Text) | | [GetEnumValueFromCaption](/business-central/docs/bc-function-list#getenumvaluefromcaption) | Returns a translated text value based on the caption text and language ID. | TableNo (Integer), FieldNo (Integer), EnumCaption (Text), TextLanguageId (Integer) | | [GetEnumOrdinalFromCaption](/business-central/docs/bc-function-list#getenumordinalfromcaption) | Returns an option value based on the caption text and language ID. | TableNo (Integer), FieldNo (Integer), EnumCaption (Text), TextLanguageId (Integer) | | [XStringReplace](/business-central/docs/bc-function-list#xstringreplace) | Replaces a given search text with a given replace text. | String (Text), SearchValue (Text), ReplaceValue (Text) | | [XStringReplaceAndEscape](/business-central/docs/bc-function-list#xstringreplaceandescape) | Replaces a given search text with a given replace text, but escapes Anywhere Mobility Solutions occurrence of the replace value in the original text. | String (Text), SearchValue (Text), ReplaceValue (Text), EscapePlaceholderValue (Text) | ## References | DataType | Short description | External reference | | --- | --- | --- | | DateExpression | A way to calculate a date relative to the current one, for example, end of month or tomorrow. | [CalcDate()](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-calcdate-string-date-method) | | FormatExpression | Defines how data formats. Different patterns exist for different datatypes. | [Formatting data](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-format-property) | ## On-premise vs SaaS Both on-premise and SaaS use the **Function Library** setup page to see what is available in the system. The method for publishing functions differs between versions. | To | See | | --- | --- | | Add your functions to on-premise | [Create a custom codeunit with expression functions](/business-central/docs/bc-create-a-custom-codeunit-with-expression-functions) | | Publish functions on the cloud | [Expose functions to the Function interface](/business-central/docs/bc-expose-functions-to-the-function-interface) | ## Related - [Expression functions mapping](/bc-expression-functions-mapping.md) - [Expose functions to the Function interface](/bc-expose-functions-to-the-function-interface.md) - [Create a custom codeunit with expression functions](/bc-create-a-custom-codeunit-with-expression-functions.md)