Solved

Specified Report Template per user

  • 15 January 2021
  • 1 reply
  • 161 views

Userlevel 2
Badge

Hello Everyone,

 

Just want to find out if we can specify a reprot template that can be used according to assigned role? e.g. when a Billing person runs a Sales Order report to be printed, it does not include the logo etc as they will be printing on a ‘pre-printed’ form and would only need the specific details like the item, price, tax etc. But if a Salesperson print the same Sales Order, it will printed everything including the logo etc.

 

Thank you guys in advance.

 

Kind regards,

Mrivera69

icon

Best answer by jknauf 15 January 2021, 16:26

View original

1 reply

Userlevel 3
Badge

Hello there Mrivera69,

This could be done pretty easily with a customization if you are or have access to a developer. You’d want to either define a new dynamic print action within an SOOrderEntry graph extension, or override acumatica’s default print button if you prefer. The code to do so would look something like this:

public PXAction<SOOrder> DynamicPrint;
[PXButton]
[PXUIField(DisplayName = "Dynamic Print")]
public void dynamicPrint()
{
SOOrder order = Base.Document.Current;

Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["OrderType"] = order.OrderType;
parameters["OrderNbr"] = order.OrderNbr;

throw new PXReportRequiredException(parameters, "ScreenID", "ScreenID");
}

Note that you would want to replace ‘ScreenID’ with the ScreenID of the report you are trying to print. So to make it print dynamically you would want to write logic to determine the current user’s role before you throw the PXReportRequiredException. If wanted to be really fancy, you could also customize your roles screen to add a field for reportID that you can then pass in as the ScreenID in the above code segment. This way you can change what report prints for each role without having to modify the code again!

One thing to keep in mind is that typically users will have multiple roles, so that may complicate your logic to determine which report to print for a given user, which is why I didn’t get more specific into solving that issue.

Anyway, hopefully this helps you. Have a happy development!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved