I am trying to add a report to the Reports menu of the SO Order Entry page via code rather than using Automation steps. The code I am using is as follows but is producing the errors: error CS0122: 'PX.Objects.SO.SOOrderEntry.Report(PX.Data.PXAdapter, string)' is inaccessible due to its protection level error CS0119: 'PX.Objects.SO.SOOrderEntry.Report(PX.Data.PXAdapter, string)' is a 'method', which is not valid in the given context
public SOOrderEntry_Extension()
{
Base.Report.AddMenuAction(sOAcknowledgementReport);
}
public PXAction<SOOrder> sOAcknowledgementReport;
[PXButton]
[PXUIField(DisplayName = "SO Acknowledgement Report")]
protected void SOAcknowledgementReport()
{
if (Base.Document.Current.OrderNbr != string.Empty)
{
throw newPXReportRequiredException(Base.Document.Current, "SO641010", string.Empty);
}
}
Does anybody have suggestions how to add a Report to the reports menu via code rather than using Automation Steps?
First you want to perform the menu add in the Initialize call and use "report" vs "Report".
Second, you will need to indicate the button as enabled by extending RowSelected. I think the automation stuff auto disables the button, so this is necessary to turn the button back using any condition you need to enable the button.
I think you can override Initialize() method and add the Report to report menu there. See the snippet code below on SOOrderEntry Graph Extension: