3

I'm looking to run a method when a file is attached to a document in Acumatica (POOrder in this case). Essentially an event that is fired when a file is attached.

Through my research I was not able to find any documentation or similar questions that relate so I am unable to provide any code.

Jeremy Hodge
  • 612
  • 3
  • 14

1 Answers1

1

File upload within the Acumatica system is done through the UploadFileMaintenance graph. The data record that is referenced is UploadFile

You can accomplish your goal of "run a method when a file is attached to a document in Acumatica" a variety of ways.

You can add an event handler to UploadFileMaintenance via an extension as seen below

public class UploadFileMaintenanceExtension : PXGraphExtension<UploadFileMaintenance>
{
    public virtual void __(Events.RowInserting<UploadFile> e)
    {
    }

    public virtual void __(Events.RowInserted<UploadFile> e)
    {
    }
}

Actions can then be determined based on the files origination information ect.

Inserting Information

Similarly you can add an event for file saving specific to PO with the following

public class POOrderEntryExtension : PXGraphExtension<POOrderEntry>
{
    public override void Initialize()
    {
        PXGraph.InstanceCreated.AddHandler<UploadFileMaintenance>((graph) =>
        graph.RowInserting.AddHandler<UploadFile>((sender, e) =>
        {
            //Your code here
        }));

        base.Initialize();
    }
}
Joshua Van Hoesen
  • 1,684
  • 15
  • 30