0

I have created my custom Entry and I need to add some reports to it. I'm trying to get Reports Dropdown like this enter image description here But all my efforts are unsuccessful.

I have action and function like is in the Receipt Entry

    public PXAction<MyMasterView> report;

    [PXUIField(DisplayName = "Reports", MapEnableRights = PXCacheRights.Select),PXButton(SpecialType = PXSpecialButtonType.Report)]
    protected virtual IEnumerable Report(PXAdapter adapter, [PXString(8, InputMask = "CC.CC.CC.CC"), PXStringList(new string[]{"PO649999","PO646000"}, new string[]{"Print My Report","Print Receipt"})] string reportID)
    {
        List<MyMasterView> list = adapter.Get<MyMasterView>().ToList<MyMasterView>();
        if (!string.IsNullOrEmpty(reportID))
        {
            this.Save.Press();
            int num = 0;
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            foreach (MyMasterViewcurrent in list)
            {
                dictionary["PARAMETER"] = current.PARAMETER;
                num++;
            }
            if (num > 0)
            {
                throw new PXReportRequiredException(dictionary, reportID, string.Format("Report {0}", reportID));
            }
        }
        return list;
    }

But as a result I'm getting the following

enter image description here

Samvel Petrosov
  • 7,580
  • 2
  • 22
  • 46

1 Answers1

2

There are a couple ways you can handle this.

One way is outlined in another question here: Acumatica - Add additional buttons to Actions drop down to screen CT30100

The other method is to utilize a list and control it with automation steps.

If you look at the PO Receipts screen you can see this.
1) Create your button method that takes a list of other items:

public PXAction<POReceipt> report;
    [PXUIField(DisplayName = "Reports", MapEnableRights = PXCacheRights.Select)]
    [PXButton]
    protected virtual IEnumerable Report(PXAdapter adapter,         

    [PXString(8, InputMask = "CC.CC.CC.CC")]
    [PXStringList(new string[] { "PO646000", "PO632000", "PO622000" }, new string[] { "Purchase Receipt", Messages.ReportPOReceiptBillingDetails, Messages.ReportPOReceipAllocated })]
    string reportID)
    {
        List<POReceipt> list = adapter.Get<POReceipt>().ToList();
    if (string.IsNullOrEmpty(reportID) == false)
    {
            Save.Press();
        int i = 0;
        Dictionary<string, string> parameters = new Dictionary<string, string>();
            foreach (POReceipt doc in list)
        {

            if (reportID == "PO632000")
            {
                parameters["FinPeriodID"] = (string)Document.GetValueExt<POReceipt.finPeriodID>(doc);
                    parameters["ReceiptNbr"] = doc.ReceiptNbr;
            }
            else
            {
                    parameters["ReceiptType"] = doc.ReceiptType;
                parameters["ReceiptNbr"] = doc.ReceiptNbr;
            }
            i++;

        }
        if (i > 0)
        {
            throw new PXReportRequiredException(parameters, reportID, string.Format("Report {0}", reportID));
        }
    }
        return list;
    }

Notice the PXStringList that has the possible values and the descriptions.

Then you can control active/inactive state from the Automation Steps.

enter image description here

The step you are missing in your original question is that you still need to add these buttons from the automation steps to add them to the list.

Community
  • 1
  • 1
Jeff Williams
  • 1,016
  • 5
  • 16