Acumatica provides reporting tools so users can retrieve data without programming skills. Since Acumatica is web-based, it’s easy to add the reports you create to the menu structure so everybody can access them. Read on to learn how to add a generic inquiry to the inquiries menu in Acumatica.
Adding Items to the Inquiries and Reports Menus
Part 1: Adding a report designer report to the reports menu.
Part 2: Adding a generic inquiry to the inquiries menu.
Environment: 6.10.0269
Data: SalesDemo data from partner portal
In last week’s post, we described how to add a Report Designer report to the Reports list on the purchase order screen. In this week’s post, we’ll tackle how to add a Generic Inquiry to the Inquiries list on the purchase order screen.
Acumatica Implementation: Adding a Generic Inquiry to a Menu
Steps to add a generic inquiry to a menu are listed below.
- Create a generic inquiry and add it to the site map
- Add the inquiry to the purchase order screen and pass information about the PO that is currently displayed
Step 1: Create Your Inquiry
Create a generic inquiry with parameters that are available on the schema from the screen you will link from. In this case, we created an inquiry with the following two parameters that are available from the purchase order screen.
- Order Type: POOrder.OrderType
- Order Number: POOrder.OrderNbr
Add your inquiry to the site map by specifying the Site Map Title and the Site Map Location as illustrated above.
You may request a copy of this generic inquiry by posting a response/comment to this article below.
Step 2: Build a customization
To expose an inquiry, we need to build a small customization. The customization will create a web URL address that we can follow to point to the generic inquiry that we created.
When I run my generic inquiry and enter a parameter, the following URL appears:
The customization we build will construct this as a string and tell the system when to call it.
- Create a customization project called Add GI to Menu.
- Open the customization project and select the option to ‘customize an existing screen’ and add the screen you will add your inquiry to (Purchase Orders in my case).
- Select the option to Customize Business Logic as shown below
- Next enter the code that you see below
using System;
using System.Collections;
using PX.Data;
using PX.Objects.PO;
namespace PXDemoPkg
{
public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry>
{
public PXAction<POOrder> inquiry;
[PXUIField(DisplayName = "Inquiries", MapEnableRights = PXCacheRights.Select)]
[PXButton]
protected virtual IEnumerable Inquiry(PXAdapter adapter,
[PXInt] [PXIntList(new int[] { 1, 2, 3 },
new string[] { "Vendor Details", "Activities", "PO Prepayments" })] int? inquiryID)
{
if (inquiryID == 3)
{
POOrder order = Base.Document.Current;
string giURL = PXGenericInqGrph.INQUIRY_URL;
string gIName = "POprepayments";
string sParameter1Name = "POnumber";
string sParameter1Value = order.OrderNbr;
string url = String.Format("{0}?Name={1}&{2}={3}", giURL, gIName, sParameter1Name, sParameter1Value);
throw new PXRedirectToUrlException(url, PXBaseRedirectException.WindowMode.New, true, "POprepayments-GI");
}
else
return Base.inquiry.Press(adapter);
}
}
}
- To get this code to work, you may need to change a few things:
- URL changes
- change ‘localhost/demo6’ to the location of your Acumatica site
- Update the screen ID (GI000030) by finding the generic inquiry in your site map and using the value you see in the screen ID without the dashes.
- Update variable name(s) to match the ones in your generic inquiry
- In this example, I specified the variable in my generic inquiry (POnumber) and pushed the OrderNbr field into the URL
- Since two inquiries already existed in the menu, we added a third option. In the code above, we format and call the URL when our report name equals ‘POprepayments.’
Next, publish this customization. This is required so we can select our inquiry from the automation steps screen.
Step 3: Use Automation Steps to add Inquiry to the Screen
Just like I linked the Report (in last week’s post), I use automation steps to add the inquiry to the screen.
- Navigate to System > Automation > Automation Steps (SM.20.50.00)
- Enter information as illustrated in the screen image below.
- Select the screen where you want to add your report.
- Select the Step ID where you want your report to appear. I used the step NL Prepaid (normal purchase order in prepaid status) so the report becomes available when a prepayment reference number exists.
- Add a new line and select the ‘inquiry’ action. Add the appropriate menu text that you want to appear (PO Payment Info in my example).
- Click ‘Fill with Values’ to open a dialog box where you can specify the inquiry location
- Use the special @inquiryID tag to define a site map value for your report
- Set the ‘value’ in the drop-down list. Your report will appear here if you published your customization in step 2.
Step 4: Test Your Results
Navigate to the screen where you added your inquiry and select a document where the status is set to the appropriate automation step.
Then run the report from the menu as shown below.
With one click, your new generic inquiry will run and populate the parameters with the purchase order number displayed on the screen when you clicked the link.
Conclusion
Acumatica provides reporting tools so you can retrieve data by building inquiries without programming skills. Since Acumatica is web-based, it’s easy to add the reports you create to the menu structure so everybody can access them. Reports and inquiries can contain parameters that allow you to display specific and relevant information. These parameters are specified prior to running the report.
Since ERP users want information instantly, Acumatica provides a way to run reports directly from data entry screens using the on-screen data to pre-populate the report parameters. In this article we demonstrated how to do this using Generic Inquiries. The result? With one-click we ran our inquiry from a data entry screen.
Acumatica makes getting data easy. With unlimited user licensing, strong mobile tools, and features such as one-click reports, Acumatica provides your entire organization with the right data wherever it is needed. Get in touch with our team to learn more about the only true Cloud ERP.