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:
https://gist.github.com/RobertWaiteREPAY/2f7897836442c4c5da355d7bae6549d1
Test Button with Conditional Compilation:
https://gist.github.com/RobertWaiteREPAY/91015ab6ce9398298347763f98180129