Good evening Daryl!
My apologies for taking so long to respond. I was traveling on Friday.
The PXOverride] missing was exactly what was causing me some issues and I did not realize I needed that command in there.
This works PERFECTLY! And works from either the SO302000 or AR301000 screens.
Thank you!
Hey @jeffgrammer69
I just realized I missed the ePXOverride] attribute above the method. That may present issues.
It should be:
namespace PX.Objects.AR
{
public class ARInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AR.ARInvoiceEntry>
{
#region Event Handlers
public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
PXOverride]
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
var result = baseMethod(adapter);
ARInvoice invoice = Base.Document.Current;
Customer customer = Customer.PK.Find(Base, invoice.CustomerID);
Base.Document.SetValueExt<ARRegisterExt.usrInvParent>(invoice, customer.ParentBAccountID);
return result;
}
#endregion
}
}
You did that right. This was my fault. Replace ARRegister with ARInvoice everywhere except ARRegisterExt.
@darylbowman
This is where my knowledge regarding Acumatica completely breaks down. There are so many graph extensions with ARInvoiceEntry in them, I simply chose the first in the list.
However, during validation/compile I have the error below.
Building directory '\WebSiteValidationDomain\App_RuntimeCode\'.
\App_RuntimeCode\ARInvoiceEntry.cs(58): error CS1503: Argument 1: cannot convert from 'PX.Objects.AR.ARRegister' to 'PX.Objects.AR.ARInvoice'
\App_RuntimeCode\ARInvoiceEntry.cs(58): error CS1503: Argument 1: cannot convert from 'PX.Objects.AR.ARRegister' to 'PX.Objects.AR.ARInvoice'
Here is the code in the extension below. What am I doing wrong here? (for future reference, how do I know I am choosing the right graph to extend?
-------------------------------------
namespace PX.Objects.AR
{
public class ARInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AR.ARInvoiceEntry>
{
#region Event Handlers
public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
var result = baseMethod(adapter);
ARRegister register = Base.Document.Current;
Customer customer = Customer.PK.Find(Base, register.CustomerID);
Base.Document.SetValueExt<ARRegisterExt.usrInvParent>(register, customer.ParentBAccountID);
return result;
}
#endregion
}
}
@darylbowman Thank you!
I will give that a go later this evening and post back here if I have an issue.
Ordinarily, I think this would do it, and you’d want it in a graph extension of ARInvoiceEntry:
public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
var result = baseMethod(adapter);
ARRegister register = Base.Document.Current;
Customer customer = Customer.PK.Find(Base, register.CustomerID);
Base.Document.SetValueExt<ARRegisterExt.usrInvParent>(register, customer.ParentBAccountID);
return result;
}
I’m not honestly sure how it works to have multiple overridden actions.
@darylbowman Thank you for the link.
I read through that and, frankly, I am not following how that works and where and how in the code logic I would update the UDF. (I am still learning the Acumatica C# code functions)
Also, in our instance, it appears there is another customization that already performs a release override; would I create a conflict?
Finally, in the example given it refers to SOOrder, would that class also pickup both the AR301000 and SO303000 screen functions for creating an invoice? (again my apologies if this is a stupid or naive question.)
Jeff
I would suggest overriding the Release action and performing the field update during the override.
This answer may assist in writing the Release override: https://community.acumatica.com/develop-customizations-288/how-to-override-an-action-in-a-graph-extension-11328