Utility Extension

Working with Utility Extension in XtendM3

Table of contents

  1. Description
  2. Use cases
  3. Step by step implementation
    1. 1. Open XtendM3 tool
    2. 2. Create new extension button
    3. 3. Extension type as a Utility extension
    4. 4. Create extension name
    5. 5. Skeleton of the extension
    6. 7. Code example of transaction extension and APIs usage
  4. Important notes
  5. Exported Extension
  6. See Also


Utility Extension is a type of extension where one can write and reuse the common logic. It is executed from another extension and eliminates the need of implementing external libraries while reusing.

Use cases

  • Keeping common logic in one place and reusing it in multiple extensions
  • Parsing date, messages
  • Number formatting, rounding etc.

Step by step implementation

1. Open XtendM3 tool

After opening M3 main page, select Menu on the top left corner. Then select XtendM3 from Administration Tools folder.

2. Create new extension button

To create a new extension select “Create a new extension” button.

3. Extension type as a Utility extension

Opened window displays an option to select the type of extension to be designed. Select “Utility” and then click “Next”.

4. Create extension name

Input extension name. Then select “Create” button.

5. Skeleton of the extension

Created extension will contain default code template.

  • APIs cannot be injected inside the Utility extension, they need to be sent in as an argument.

Over the code field there are several tools with which you can operate on the designed extension.

Listing them from the left side they are used to:

  • Enable editing mode
  • Export the code
  • Extra settings to change the parameters of the extension or enable it etc. (inactive)
  • Delete the extension
  • Information about the extension
  • Test compile
  • Refresh

7. Code example of transaction extension and APIs usage

To start writting extension code enable editing by clicking “Edit” button. This extension can be used both with APIs and Trigger extensions. To read more documentation on API specification click on the link.

Example below shows utility used to date and time formatting that can be called and executed from another extension.

To finish save written extension by clicking “Save” button. It is not necesary to activate the extension from settings for it to be exectuted.

Important notes

  • Always test the examples for your own solution before using them in production
  • It is a good practice to use a test compilation of the program before running
  • Data presented in the examples is random

Exported Extension

See Also

More examples
API documentation