简体   繁体   中英

Adding custom action to Special Folders of action menu on Bills and Adjustments (AP301000) screen

I would like to add a custom action to the Bills and Adjustments (AP301000) screen which navigates to a report. I want to add the action to the special folder in acumatica (action menu) as shown on screenshot 1 where the red line is.

Screenshot 1: Action Menu

截图 1:操作菜单

Below code is used to add the action to the menu

  public class APInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AP.APInvoiceEntry>
    {
 public override void Initialize()
         {
            base.Initialize();

            //this added the report to the reports menu

            Base.report.AddMenuAction(SupplierInvoice);



        }
            
        public PXAction<PX.Objects.AP.APInvoice> SupplierInvoice;

        [PXButton(CommitChanges = true)]
        [PXUIField(DisplayName = "Supplier Invoice")]
        protected void supplierInvoice()
        {
            if (Base.Document.Current.RefNbr != string.Empty)
            {
                //create parameters for report! Check report by editing it to see what reports are needed
                Dictionary<string, string> parameters = new Dictionary<string, string>();

                parameters["RefNbr"] = Base.Document.Current.RefNbr.ToString();
                parameters["DocType"] = Base.Document.Current.DocType;

                //the report number gets set below and parameters are sent with


                throw new PXReportRequiredException(parameters, "AP641500");


            }
        }

        }
}

The error which I get is shown in below screenshot

Screenshot 2: Code error

截图 2:代码错误

The issue I encountered is that the report folder for the Bills and Adjustments (AP301000) screen in the screen editor of the customization does not the Layout Properties as shown in the screenshot below:

Screenshot 3: Bill and Adjustments (AP301000) Screen Editor

屏幕截图 3:账单和调整 (AP301000) 屏幕编辑器

The Acumatica Version I am currently using is: 22.101.0085

How could I possibly fix the error in order to add the action in the action menu of the screen?

You can apply a Category to the action that should position it correctly in the category:

public override void Initialize()
{
    base.Initialize();
    SupplierInvoice.SetCategory("Reports");   
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM