Home Blog VLOG: Using PowerShell for Acumatica Code Generation

VLOG: Using PowerShell for Acumatica Code Generation

In this Vlog, Robert Waite from REPAY walks you through how PowerShell can be used to generate code automatically.
Robert Waite | December 30, 2021

With Code Generation, we developers are writing code to write code. The use-case for this VLOG is to solve a problem we had with the Acumatica open-source Surveys project. We wanted to automatically generate default configuration records needed to facilitate creating basic surveys.

Various options we explored are discussed, and reasons are given as to why some choices were not ideal. We cover the concept of the partial keyword that allows you to split a single class into a manually maintained section of the class where the code-generated portion of the code has its own file.

We also cover the CustomizationPlugin interface as a means to auto-deploy records on publishing a package. A few challenges are discussed in finding a way to troubleshoot code by using a temporary PXAction button. There is no clear way to wire up a debugger within the CustomizationPlugin class, and the PXAction allows us to step through code.

Happy Coding!

Gist Links:

Powershell script:


Test Button with Conditional Compilation:


Blog Author

Robert is the Lead Acumatica Developer at APS Payments, a REPAY company, a leading provider of omni-channel B2B integrated payment solutions. Robert’s passion for programming started in grade school doing projects on the Apple IIe, and he checked out all the library books he could on the topic to appease his voracious appetite for learning how to code. Robert started working with ERP platform software in 2003, where he automated distribution tasks on a green screen apps called PICK, which he later replaced with Sage 100. Since then, he has expanded his expertise to many other ERP systems, including Acumatica. Prior to joining APS Payments, Robert worked for Accounting Systems, Inc. (ASI Focus), where he was an ERP Software Developer. Outside of programming, Robert is passionate about dancing, where you will find him spending a lot of time looking for any opportunity to West Coast Swing, Hustle, Salsa, as well as many other styles of dance. In his spare time, he enjoys soldering together racing drones and IoT home automation projects. Robert volunteers his time at a local high school maker space and has taught classes on programming Arduinos and other IoT development boards like the Raspberry Pi.

Receive blog updates in your Inbox.