Reusable ASPX Definitions

Introduction

Acumatica has spent a lot of time thinking about making its xRP Framework as developer-friendly as possible. In many different places, efforts have been made to reduce code duplication and to provide quasi “object-oriented” methods for managing elements in the framework. One of those places I will demonstrate to you today is the definition of ASPX Pages.

When one is writing custom ASPX pages in Acumatica ERP, the xRP framework allows for reused ASPX definitions to be referenced from a common file, instead of having to copy and paste a common control over and over across multiple pages. Imagine you have three pages, all with the same popup control.

ASPX-Graphic

This is a bit dangerous because if you one day need to make a change to the popup definition, you have to copy the changes across 3 different files, and remember all the files in which the change needs to be made! Sounds like a recipe for a bug.

What you can do instead, is extract the popup definition out of the ASPX files, and into its own include file (use file extension .inc)

ASPX-Graphic

Acumatica will pull the ASPX definition out of the PopupDefinition.inc file, and combine it with the IN000000.aspx, IN000001.aspx and IN000002.aspx files. Therefore, you only need to make changes to the popup definition in one place, and it will be included wherever it is referenced!

Conclusion

This is a very useful tool for creating common ASPX definitions across multiple Acumatica screens. Along with common business logic extensions, one can write a single definition for business logic and presentation, and use it across many pages.

Cheers to another tool to avoid code duplication!

Hope this has been helpful and always…

Happy Coding!