Automating Print Preview

I am looking for a way to automatically print preview a BAQ report.

As far as I know, there are two ways to potentially do this…

  1. BPM
  2. Application Studio event

So far, I have been trying via a BPM, but not having much luck :frowning: Has anyone managed to do this?

Please provide your business use case?

E.g If the user checks auto-print ready on the Sales Order Header. It will generate a auto print preview.

Hi Aaron,

When Shipped is ticked on a Pack Slip, I want to check whether the Export Control BAQ Report has been run. I have added a UD field to the ShipHead_UD table to check whether this has been done. If it hasn’t been run, I would like it to generate the report automatically.

We had done something similar in the Classic UI where the user would click a button, and the report would automatically generate. Since moving to Kinetic, we added a button that would open the report screen in a slide-out panel, but the user would have to run the report manually.

There is a desire from our team to return to the previous functionality if possible.

The problem here is that unlike sending something to a printer, print preview involves the client computer doing the work. That’s a non-starter from a BPM because the BPM is running on the server (or even a cloud server). You can appear to do it, but the best result is usually a notification that the print preview has happened in the system monitor, without the preview itself.

And browsers intentionally make this kind of thing difficult, too, for security reasons.

There are clever workarounds, depending what level of complexity is worth it, I think? But it’s not as easy as it feels like it should be. In classic you could mimic the user behaviour directly but I don’t think that provision is there in Kinetic, at least not yet.

You should be able to do this with a data directive. Put a condition in your data directive to check if ready to invoice has changed from false to true and if your UD field is false. Use the Autoprint widget to print preview off the true branch. Then afterwards set your UD field to true so you know not to print it again. I think it will work.

1 Like

Apologies for the delay, I second Alisa.

A data directive works well here. If you already have your UD boolean and date/time fields on ShipHead_UD, just use those as the gatekeeper. When Shipped is ticked, check the UD flag and, if the report hasn’t run, trigger Auto Print, then update your UD fields with the timestamp so it doesn’t fire again.

You’ll also want to handle the reverse case – if a user unticks Shipped, clear the UD flag and date/time so the logic resets correctly.

Thanks all for the advice on this one.

Despite having some difficulty, I have managed to use a Method Directive (pre-processing), which was my preferred method. Here’s what I did:

  • Built a BAQReport parameter row for my report and injects the current PackNum into the BAQ prompt, so it mirrors what the BAQ Report screen normally sends.
  • Uses AutoPrintHandler to generate the correct Filter XML so SSRS doesn’t choke on it.
  • Submits the report as a PDF preview to the SystemTaskAgent, which makes it appear in System Monitor just like when you preview it manually.
  • Sets a UD flag on ShipHead afterwards so it only runs once per pack and doesn’t retrigger.