Custom audit log message

Hello,

I have created a recipe system in ignition. Everytime a recipe gets updated in the “recipe” table I make a backup of this recipe in the recipes_Version table where the column “Version” is a value that gets + 1 everytime.

system.db.runPrepUpdate(“INSERT INTO Recipes_Version (Recipe_Nr, Object_Name, Object_Type, R001, R002, R003, R004, R005, R006, R007, R008, R009, R010, R011, R012, R013, R014, R015, R016, R017, R018, R019, R020, R021, R022, R023, R024, R025, R026, R027, R028, R029, R030, R031, R032, R033, R034, R035, R036, R037, Version) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)”, [id_Insert, Object_Name_Insert, Object_Type_Insert, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R30, R31, R32, R33, R34, R35, R36, R37, Version_Insert])

This works perfectly now the problem is this does not show up in the audit log. I want a message in the audit log that says “Recipe XXXX adjusted new version XXXX added to DB”.

Does any of you have an idea how to create this audit log?(preferably with an example :slight_smile: ) Do you also use system.db.runPrepUpdate? What about making sure you don’t have the same ID twice etc.

Did you ever figure out how to do this?

Don't assume to know the context, but a call to system,util.audit should be able to accomplish this...