Notes on Acumatica developers summit 2018

Hi all,

Recently I visited virtual developers conference for Acumatica.

Here I want to document some details that were mentioned during that summit.

First of all, I'd like to say that idea from Gabriel Michaud about making some global functionality for each page.

Using PXGraph extension for creating a global button

Consider for example how to implement a global button using PXGraphExtension:

public class GloalGraphExtension : PXGraphExtension<PXGraph>
{
    public override void Initialize()
    {
        if (!string.IsNullOrEmpty(Base.PrimaryView))
       {
           //Add a "Test" button in the toolbar    
           Type primaryViewItemType = Base.Views[Base.PrimaryView].Cache.GetItemType();
           PXAction action = PXNamedAction.AddAction(Base, primaryViewItemType, "Global Test""Global button", TestClick);
       }
    }
 
    private IEnumerable TestClick(PXAdapter adapter)
    {
        throw new PXException(
        $"Button clicked from graph {Base.GetType().Name}. This graph has {Base.Caches.Count} caches");
    }
}

So now in all views on toolbar will be this created "Global Button".

Also, for example we can implement logic for notes and add date-time created and user name:

In GlobalGraphExtension add event:

public void NoteFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e)
{
    if(!String.IsNullOrEmpty(e.NewValue as string))
      {
        //The change will only be visible after reloading page, the note pannel caches it...
        e.NewValue = e.NewValue + $"added {DateTime.Now.ToString()} by {PXAccess.GetUserLogin()})\n";
      }
}

So now every note will be with date-time and login who created it :)

Other areas where you can consider usage of such staff can be configure some kind of dependency injection techniques in such a graph.

No Comments

Add a Comment