Contents tagged with Persist

  • How to override the Persist method properly

    Hello everybody,

    today I want to write a few words on how to override persist method of Acumatica properly. When I say properly I mean not save just some fragment of data, but use transaction like approach.

    In other words how to achieve all or noghint during persisting.

    Quite often I see template like this:

    public void Method1()

    {

        //normal flow

    }

    string message = "Forbidden to do anything at 18 hour";

    public void Method2()

    {

        if (DateTime.Now.Hour == 18)

        {

            throw new PXException(message);

        }

    }

    public void RollBackMethod1AndMethod2()

    {

    }

    [PXOverride]

    public void Persist(Action del)

    {

        try

        {

            del();

            Method1(); … more

  • How to extend Persist of your own graph in Acumatica

    Hello everybody,

    here I want to leave a short line on how to extend Perist method of your own graph.

    I described once long time ago how to override Save action in your extension, but sometime it can be needed to override Persist in your own graph.

    Sometime it can be necessary. Below goes sample of code for this purpose:

    public override void Persist()

    {

    //Some other custom business logic

    base.Persist();

    }

    Here you go.

    more