Please help on one customization scenario I can't figure well.
Inside a transaction screen I have a customized Print button. The button launches a ROISRS report that shows the transaction currently open in the screen. The screen itself is CN.SPR.00 which handles payment for contractors. This report has some official weight payment wise.
Some users have been clicking this Print button and rendering the report as a pdf file. In fact, they print the report for the supervisor's signature. A week later they notice the rendered report is different from the registered transaction. The rendered report has some consistency errors (they signed anyway) but the registered transaction is correct. If they reprint the transaction they see it right and consistent. Checking the pdf time signature it says 18:09:42 and the record's lupd_datetime says 18:10:00.
So what happened? In a test environment I checked you can click the Print button before saving the on-screen transaction to the database. So, the ROISRS rendering process sees dirty data.
So, first solution: make a call on Edit_Save on every click of the Print button before launching the report. This does work and the report always render clean data.
Problem: the Edit_Save may fail and the report launches anyway.
This kind of screens do have several business oriented rules to check. The Edit_Save expectedly enforces them all, but has no return value. Hitting the Print button in this case yields a prompt indicating the offending data, but the report comes anyway.
Second solution: make a call on Edit_Save and set up a flag. The flag gets cleared during the OnUpdate events sequence. The report launches only on a cleared flag. This way the report does show only after a successful save. On a failed save, the user does get a prompt with the validation stuff.
Problem: there are times in which there's no changes to save. Even if you call Edit_Save, the OnUpdate events don't trigger, the flag never gets cleared, no validation prompt appears, no report also. So, the Print button is a do-nothing.
Here I'm stuck now. There should be an obvious way I'm missing. The Print button is an obvious thing. In this kind of system, the reporting engine always works on a separate context, hence you always should save before print.