Skip to main content
Solved

Specified Report Template per user

  • January 15, 2021
  • 1 reply
  • 194 views

Forum|alt.badge.img

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

Best answer by jknauf

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!

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img
  • Varsity II
  • 35 replies
  • Answer
  • January 15, 2021

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings