BPC-Components

Home > Products > BPC PowerForms - Silverlight > Knowledge Base > General > Setup an audit mechanism

Setup an audit mechanism


You can implement an auditing procedure for your data forms using the "After Update Post Url" property (Options tab).
If you declare a web page in that property, a web post containing the action (preinsert, preupdate, predelete, postinsert, postupdate, postdelete) and a list of field name/field value pairs, will be made after each insert, update or delete action in the form.
 
For example if you write the following C# code in the audit page :
Code

string path = Server.MapPath(".")  + "\\log.txt";
System.IO.StreamWriter w = new System.IO.StreamWriter(path, true);
 
w.WriteLine("###########################");
foreach (string key in this.Request.Form.Keys)
{
   w.WriteLine(key + " = " + Request.Form[key]);
}
w.Close();

 
Something like the following will appear in the log file:
Code
 
###########################
_action = postupdate
_user = administrator
ContentTypeId = 0x01000CE17A83B943CD42A44746C0A4C20AE7
Title = This is the Title
_ModerationComments =
LinkTitleNoMenu = This is the Title
LinkTitle = This is the Title
File_x0020_Type =
ID = 1
ContentType = Item
Modified = 2011-10-14 11:15:49
Created = 2011-10-14 10:55:42
Author = 1;#administrator
Editor = 1;#administrator
_HasCopyDestinations =
_CopySource =
owshiddenversion = 5
WorkflowVersion = 1
_UIVersion = 512
_UIVersionString = 1.0
Attachments = 0
_ModerationStatus = 0
Edit =
SelectTitle = 1
InstanceID =
Order = 100
GUID = {FFCB0333-0760-4E0D-A915-DB5ECFDCCF42}
WorkflowInstanceID =
FileRef = /ET/Lists/Departments/1_.000
FileDirRef = 1;#ET/Lists/Departments
Last_x0020_Modified = 2011-10-14 10:55:42
Created_x0020_Date = 2011-10-14 10:55:42
FSObjType = 0
PermMask = 0x7fffffffffffffff
FileLeafRef = 1_.000
UniqueId = a6b9763b-f0e3-438e-86fe-8f77932dc40f
ProgId =
ScopeId = {E98C719C-C0F4-4151-81BC-BDC753D63E62}
HTML_x0020_File_x0020_Type =
_EditMenuTableStart = 1_.000
_EditMenuTableEnd = 1
LinkFilenameNoMenu = 1_.000
LinkFilename = 1_.000
DocIcon =
ServerUrl = /ET/Lists/Departments/1_.000
EncodedAbsUrl = http://serverName/ET/Lists/Departments/1_.000
BaseName = 1_
MetaInfo =
_Level = 1
_IsCurrentVersion = 1