Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Global events

Before audit log

Scroll Prev Next More

Description

The Before audit log event is executed before a record is added to the log.

Syntax

public XVar OnAuditLog(dynamic action, dynamic parameters, dynamic table, dynamic keys, dynamic newvalues, dynamic oldvalues)

Arguments

action

the occured action.

params

params[0]: the user's IP address, params[1]: username.

table

the modified table.  

keys

an array of key column values pointing to the current record.

newvalues

an array of field values added to the database. You can modify any of those fields, see Example 2.

oldvalues

an array of the previous field values. Applies to the Edit and Delete functions.

Return value

True: save the action in the log.

 

False: do not save the action in the log.

Applies to pages

All pages. Insert your code into the Before audit log event.

Example 1

If you do not want to record the actions done by the admin in the audit log, you can use the following code:

 

if (parameters[1] == "admin")
{
  return false;
}
return true;

 

Example 2

Replace ID with the actual value from the lookup table and save it in the audit log.

 

 

 

if (table=="cars")  {
     newvalues["makeid"] = DB::DBLookup(DB::PrepareSQL("select name from makes where id=:1", newvalues["makeid"] ) );
}

 

See also:

Audit and record locking

Security screen