Introduction
Acumatica has the ability to customize almost any screen to provide additional information or business logic that is required by an ERP client. Customizations are done using the Acumatica xRP platform and seamlessly integrate into the ERP (Enterprise Resource Planning) platform, the extension is robust and agile, ensuring that it would allow the application to still be upgradeable and when the package is removed, returns the application to its original state.
In this blog, we will create a customization package that would allow the business users to specify and internal PO Order type, which can be used for workflows, assignment maps and reports. In addition, the package includes a selector’s column renaming.
Creating Customization Package
For creating customizations, go to Customizations and open Customization Projects (SM204505). On the screen, create a new customization and open the link.
NOTES:
- User needs to have Customizer role
- Project naming convention to be relevant to the function
- Provide a version number sequence to manage the customization reiterations (on description)
- Minimum Acumatica Build
- Version reiteration
- Project Level is important for two reasons:
- The more important the customization, the higher the number
- It ensures that customizations do not merge and cause conflicts
Once the customization package has been created, start with screens, and add all the required screens for the customization. Below we are adding a Purchase Order screen (PO301000):
On the screen, create a user defined field for the Internal Order Type.
Adding custom fields, based on storage type (DBTableColumn), could create a column in the database. By following this process, two additional items on the project is created:
- Data Access – DAC field and it’s attributes
- Database Scripts – the script Acumatica generates to create the column (DBTableColumn storage type)
NOTES:
- User defined fields need to be specified with ‘Usr’ prefix. This is to ensure the column does not get removed during upgrades
- When adding new fields, the project needs to be published before the field can be used
- Field is added to the screen with ‘CREATE CONTROLS’
- When adding new fields, ensure the correct view selected when creating the field, i.e. if it is on the header, make sure the summary section is selected when creating new fields
- Review and adjust field attributes before adding the field onto the form
- If this item is not done, the original item type will be used. This is an issue when a field is created for a dropdown or selector but not defined. Without it, the field would be added as a plain text field
On ‘CREATE CONTROLS’, the field is added onto the view. Once added, the field (based on selector field type) has a list of attributes. Two properties are required to be reviewed
- CommitChanges – this property would trigger the field updated event
- ID – The control’s identifier on the page. Acumatica by default would provide a Cst… field ID. Pro-tip Change the ID to be unique to the field, as other customizations on the same site might have the same custom ID value assigned and will cause a conflict issue
On Data Access, convert the item to an extension to. The item would move to the Code section for further amendment.
From the code section, additional activities can be performed:
From the above the following:
- Code section lists all the code’s extensions
- Override Method provides a list of methods/actions that can be override, this allows for an original method to be called and can be modified
- New action provides the code to create new actions “buttons” on the screen
- Moving the code to an extension library/code-behind (dll file)
After the DAC extension has been modified for the DAC field’s attributes, the field can be added to the screen. (More information on the extension coding is in the following section)
The DAC field is set as a selector, which will list the attributes’ IDs and descriptions.
Code
GIST: https://gist.github.com/Gerhard-ZA/102d5a2c5a182e8795bbb19733dee6ee
Extending the package to code-behind
To move the extension, click on the Extension Library and create/open extension library.
Opening Visual Studio, the extension file would be available on the solution explorer.
- PO Order Extension file is available on the solution explorer, this file is used when attaching the extension library to Internet Information Service (IIS).
- NOTE – If the file (extension) is on both Customization Package and Visual Studio, the customization package file would be used for processing
- The class name of the extension, this name should be unique as it could cause a conflict issue if the application has the same extension name on another customization package
- IsActive method allows business logic to identify if the extension should be used or not. This method can be used with business logic or setup to only activate on certain conditions
On creating an extension library, the dll file would need to be included on the customization project in order to have the customization package functional.
The final result
Link to Customization Package → URL
Summary
By using the methods provided in the post, you will be avoid issues with other published customizations and keep your packages clean and maintainable now and in the future. Look for further customization best practices to continue from myself and other Developer MVPs.
Good luck and Happy Coding!