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!

No comments: