Thursday, 16 March 2017

Launch Multiple Reports with one Exception

Hi All

Today I want to share with you an example how you can launch multiple unrelated reports with one single PXReportRequiredException.

PXReportRequiredException has a helper method - CombineReport(..), where you can pass multiple ReportRequiredExceptions and Acumatica will process them together.

Acumatica will extract each separate report from extension and can open it with following rules:

  • Print all report as a single PDF file - ex.SeparateWindows = false;
  • Open each separate report in a new tab - ex.SeparateWindows = true;

There same rule as with other Pop-ups we can open it with new tab, window or the same window as well - ex.Mode = PXBaseRedirectException.WindowMode.New;

Also note that you should pass report parameters to all reports separately.

report parameters acumatica


Full Code Snippet:

Have a nice development!

Tuesday, 14 March 2017

Copy notes from AP/AR Invoice to GL Batch

Hi All,

Just want to share with you short example of how you can copy Notes and Files from AP/AR invoices directly to General Ledger Batch.

For archive it we are doing following steps:
  1. Define extension for (AP/AR)ReleaseProcess graph. Exactly this graph is responsible for releasing operation.
  2. On the Initialize method we are trying to subscribe on InstanceCreated event for JournalEntry graph, where we can catch exact graph instance used for saving batch. 
    1. InstanceCreated even is very useful for customization purposes. Here you can subscribe events and pass parameters between different graphs.
  3. Subscribe to ARRegister_BatchNbr_FieldUpdated to catch moment when batch is saved and linked to our invoice.
  4. Using graph and batch number we can find exact batch.
  5. Using PXNoteAttribute.CopyNoteAndFiles we can copy notes and files from one object to another.
Full Code Snippet:

Have a nice development!