I have an idea for creating a custom note on an LU and populating it with history log data.
- BUSINESS NEED: We want to log the changes of certain fields on Purchase Orders, and want that information to be assembled in a note that can be attached to the Purchase Order. We do not want to use the Purchase Order note for this, we want a special field (so will add it as a Custom Attribute of the PurchaseOrder LU).
- ELEGANT PATH: Use History Log to store changes to the Purchase Order for just the fields we want. Then add a Custom Event to the PurchaseOrder LU, “after” save, linked to a PL/SQL Action that grabs History Log data related to a recent time-frame, the current purchase order, and the current user. Append new History Log information to the custom note we added in Step 1.
- CHALLENGE: Timing and avoiding redundant data. Does IFS write data to the History Log, synchronously and completely, before an “after” Custom Event fires for the LU? How can we determine what changes just occurred and avoid re-writing the whole history for the purchase order over and over again?
I understand that we could “roll our own” logging by using the OLD and NEW field values in the Event and Action. But if the History Log can do all that work for us it will make the PL/SQL much easier to write. I’m just not sure we can rely on the timing to work out so that History Log data is available immediately after the save (and before the Event fires and goes looking for the data).
I also realize we could create strings to append to the custom log field where we could look for text already existing in the note. That way we would avoid re-appending data that was already in the note (e.g. from a change made previously). So I am not as worried about repeating data as I am about knowing the new data is going to consistently be there.
Doing it this way also means we do not need to retain History Log data for very long. If we persist it to a note linked directly to the Purchase Order it doesn’t matter if that log information gets deleted later.
Has anyone developed a persistent logging/audit trail based on this approach? Can anyone confirm the timing and synchronicity of History Log writes? I can certainly start mocking up some tests, but if someone knows for a fact that History Log writes are asynchronous, for example, I really don’t need to bother because this idea could never work if that is the case.
Best answer by duretteView original