Kbase P26433: What do I need to do to enable auditing with in dynamics?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  14/01/2009 |
|
Status: Verified
GOAL:
What do I need to do to enable auditing with in dynamics?
GOAL:
Why when I enabled auditing in the entity control doesn't the audit records get created for my table?
FACT(s) (Environment):
Dynamics
Windows
Progress 9.1x
FIX:
Dynamics provides a generic auditing feature to allow the tracking of changes to a table. This includes when records are added, deleted and changed in any way. There are 2 things that generally need to be done in order to get this behavior to work:
1) Setup the Generic Auditing Procedure to run for the required table.
The usual place for putting the code is in the table database triggers. Here are examples of the code needed for each of the three sorts of triggers (add, delete, and write):
A ?CREATE? trigger running the generic auditing procedure:
IF CAN-FIND(FIRST gsc_entity_mnemonic
WHERE gsc_entity_mnemonic.entity_mnemonic = 'gsclg':U
AND gsc_entity_mnemonic.auditing_enabled = YES)
THEN
RUN af/app/afauditlgp.p (INPUT "CREATE":U
,INPUT "gsclg":U
,INPUT BUFFER gsc_language:HANDLE
,INPUT BUFFER o_gsc_language:HANDLE
).
A ?WRITE? trigger running the generic auditing procedure:
IF CAN-FIND(FIRST gsc_entity_mnemonic
WHERE gsc_entity_mnemonic.entity_mnemonic = 'gsclg':U
AND gsc_entity_mnemonic.auditing_enabled = YES)
THEN
RUN af/app/afauditlgp.p (INPUT "WRITE":U
,INPUT "gsclg":U
,INPUT BUFFER gsc_language:HANDLE
,INPUT BUFFER o_gsc_language:HANDLE
).
A ?DELETE? trigger running the generic auditing procedure:
IF CAN-FIND(FIRST gsc_entity_mnemonic
WHERE gsc_entity_mnemonic.entity_mnemonic = 'gsclg':U
AND gsc_entity_mnemonic.auditing_enabled = YES)
THEN
RUN af/app/afauditlgp.p (INPUT "DELETE":U
,INPUT "gsclg":U
,INPUT BUFFER gsc_language:HANDLE
,INPUT BUFFER o_gsc_language:HANDLE
).
If you don't wish to put these in to the triggers but else where in your code (for example an SDO's logic procedure) you code use the following code:
DEFINE VARIABLE cEntityMnemonic AS CHARACTER NO-UNDO.
RUN GetTableDumpName IN gshGenManager
(INPUT ?gsc_language?
,OUTPUT cEntityMnemonic
).
RUN af/app/afauditlgp.p (INPUT "WRITE":U
,INPUT cEntityMnemonic
,INPUT BUFFER gsc_language:HANDLE
,INPUT BUFFER o_gsc_language:HANDLE
).
(note: In all these instances, the triggers are for the gsc_language table. gsclg is the tables entity Mnemonic and o_gsc_language is the old buffer and gsc_language is the new buffer. The old buffer needs to be created and can be in the write trigger by adding the following to the trigger procedure statement:
OLD BUFFER o_gsc_language.
making it:
TRIGGER PROCEDURE FOR WRITE OF gsc_language OLD BUFFER o_gsc_language.).
2) Enable auditing within the entity information.
The second point is rather easy to set up and can be done by going to the Entity Control menu item that is in the System menu of the Administration menu.
The code implemented in step 1 will check this flag to determine if the auditing trail should be logged.