Working with Utility Extension in XtendM3
- Use cases
- Step by step implementation
- Important notes
- Exported Extension
- 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.
- Keeping common logic in one place and reusing it in multiple extensions
- Parsing date, messages
- Number formatting, rounding etc.
After opening M3 main page, select Menu on the top left corner. Then select XtendM3 from Administration Tools folder.
To create a new extension select “Create a new extension” button.
Opened window displays an option to select the type of extension to be designed. Select “Utility” and then click “Next”.
Input extension name. Then select “Create” button.
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
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.
- 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