Apply Customization to all Graphs

Hi All,

Today want to share with you one tip how can you add customization to all graphs at once.

You know that you can define graph extension with specific graph – PXGraphExtension<PX.Objects.GL.JournalEntry>. However, all graphs are inherited from one base class ether PXGraph<TGraph> or PXGraph<TGraph, TPrimaryView>. In that case PXGraph is normal class and can be used as standalone object.
In terms of our customizations that means that we can create an extension for parent PXGraph and it will be used with any graph in the system automatically.

Here we have an example how can you add a special setup to any graph in Acumatica. Please note that we are using Initialize method instead of constructor because dataviews are not yet initialized when extension constructor is called.

public class PXGraph_Extension : PXGraphExtension<PXGraph>
{
        public PXSetup<PX.Objects.GL.GLSetup> GLSetup;

        public override void Initialize()
        {
                 Object row = GLSetup.Current;
        }
}

Warning: please be careful with using this method as if you have do any code mistake than this error will pops up on any graph in the system including customization graphs. So if your code throws an exception you may not be ably to access it with Customization Browser anymore as it also based on graphs.

Big thanks to Gabriel and Andrew for sharing knowledge for this article.
Have a nice development!

Leave a Reply

Please rate*

Your email address will not be published. Required fields are marked *