I’m overriding the Print Shipment Confirmation menu option on the Shipments screen
In my code, I want the option to use my override, or use the base method.
When I call the BaseMethod from my delegate, it is null. I’m not sure what to do.
Here is the code for my override:
[PXOverride]
public delegate IEnumerable PrintShipmentConfirmationDelegate(PXAdapter adapter);
[PXButton]
[PXUIField(DisplayName = "Shipment Confirmation")]
public IEnumerable PrintShipmentConfirmation(PXAdapter adapter, PrintShipmentConfirmationDelegate BaseMethod)
{
try
{
SOShipment shipment = Base.Document.Current;
string screenID = "SO302000";
string reportID = "SO642000";
string printerName;
ICSPrintHubActions iCSPrintHubActions = SelectFrom<ICSPrintHubActions>
.Where<ICSPrintHubActions.screenID.IsEqual<@P.AsString>
.And<ICSPrintHubActions.reportID.IsEqual<@P.AsString>>>.View.Select(Base, screenID, reportID);
if (iCSPrintHubActions == null)
{
throw new PXException(ICSMessages.PrintHubActionNotFound, screenID, reportID);
}
if (iCSPrintHubActions.Active == false)
{
if (BaseMethod != null)
{
return BaseMethod.Invoke(adapter);
}
else
{
return adapter.Get();
}
}
----the rest of the code is not needed to show here...The idea is that if the iCSPrintHubAction is not active, fire the BaseMethod.Invoke(adapter);
At least that is what I think I need to do.
Note that if I get rid of the BaseMethod.Invoke stuff, the override does what I want. I’m just trying to do the non-overridden action if the test record is not active.
Any ideas why my BaseMethod from the Delegate is null?