Skip to main content
Answer

Transfer SO custom fields to IN custom fields

  • December 18, 2024
  • 1 reply
  • 60 views

Forum|alt.badge.img

Hello - We currently have custom Start and End date fields on the sales order screen and also on the AR invoice screen. However now we would like to be able to send values from the SO fields to the AR invoice fields. Can someone please tell me how we can achieve this?

Best answer by darylbowman

Because an Order can be invoiced from ‘Sales Orders’ and ‘Shipments’, you need a method called by both of them. You’ll want to extend the InvoiceCreated method of SOInvoiceEntry like this:

public delegate void InvoiceCreatedDelegate(ARInvoice invoice, InvoiceOrderArgs args);
[PXOverride]
public virtual void InvoiceCreated(ARInvoice invoice, InvoiceOrderArgs args, InvoiceCreatedDelegate baseMethod)
{
baseMethod(invoice, args);

// Put your code here like:
Base.Document.SetValueExt<ARInvoice.docDesc>(invoice, "Some new description");
Base.Document.Update(invoice);
}

 

1 reply

darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • December 18, 2024

Because an Order can be invoiced from ‘Sales Orders’ and ‘Shipments’, you need a method called by both of them. You’ll want to extend the InvoiceCreated method of SOInvoiceEntry like this:

public delegate void InvoiceCreatedDelegate(ARInvoice invoice, InvoiceOrderArgs args);
[PXOverride]
public virtual void InvoiceCreated(ARInvoice invoice, InvoiceOrderArgs args, InvoiceCreatedDelegate baseMethod)
{
baseMethod(invoice, args);

// Put your code here like:
Base.Document.SetValueExt<ARInvoice.docDesc>(invoice, "Some new description");
Base.Document.Update(invoice);
}