Pass value of custom field from SO to Invoice

  • 11 November 2021
  • 6 replies

Userlevel 5


Was wondering if anyone can give me a hand with this… We essentially want an exact duplicate of the Description (OrderDesc) field that is already on sales order/invoices.

I have created a new field on each entry screen, but am stuck trying to pass the value from the SO to the invoice.

I assume I should override the PrepareInvoice action, but not sure how to actually reference the fields I have created? 


I.e. This is as far as I got but i know “  ThisNewInvoice.CustomerSubject = row.CustomerSubject; “ is obviously wrong


Any help is appreciated!!

public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>

public IEnumerable PrepareInvoice(PXAdapter adapter, Func<PXAdapter, IEnumerable> baseMethod)
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);

var row = (SOOrder)e.Row;

ThisNewInvoice.CustomerSubject = row.CustomerSubject;

return baseMethod(adapter); // and then return



Best answer by Dmitrii Naumov 12 November 2021, 00:31

View original

6 replies

Userlevel 7
Badge +5

I think you may find that slide deck useful. 


Also, you need to know several things:

  1. To access custom field you need to use GetExtension method. See here:
  1. In general a Sales Order is not related 1-1 to an invoice. You may have several invoices prepared for the same sales order (e.g. in case of partial shipping) or you can have multiple sales orders  consolidated in one invoice. Or you can have any mix of them. So you need to take that into account when developing that customization.
  2. You don’t really have the access to the Invoice that is created from the PrepareInvoice method. The proper place for such customization is SOInvoiceEntry.InvoiceOrder method. From that method you have the access to both the SO and the invoice. Also, that method is triggered for all the scenarios when the Invoice is created from a Sales Order while PrepareInvoice method only works when you click that button directly on the Sales order screen.
Userlevel 7
Badge +17

@dnaumov This is very useful, thanks a lot for sharing it here.

Userlevel 5

Thank you @dnaumov this looks like it will be really helpful. Going to work through it a bit before closing thread

Userlevel 6
Badge +5

There is also an InvoiceCreated method that gets called after the invoice is created inside the InvoiceOrder method if I recall correctly. 

public void InvoiceCreated(ARInvoice invoice, SOOrder source, InvoiceCreatedDelegate baseMethod)

You can then pull over any info from the source SOOrder to the ARInvoice. 

Userlevel 3

Hi @Dmitrii Naumov ,

Could you please share source code in the GIT again? 


Userlevel 7
Badge +5

@mrthanhkhoi  I’m afraid I don't have the code anymore. There are some code snippets in the slides, probably you can use those. 


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved