Friday, June 17

Audit trail functionality limitation with Assignment manager

As per Siebel bookshelf,Audit Trail functionality have one constraint that "The record updates that are performed through Assignment manager cannot be audited".

You can achieve this with some scripting and the example is given below

Example: In case of Service Request assignment, where it is interactive assignment.

>> On Interactive Assignment Pick Applet (Assignment Results (Employee) List Applet), we can have a code on PreInvokeMethod of Assign method as below which will hold Old and New values of Owner:

function WebApplet_PreInvokeMethod (MethodName)
{
    try
     {
        if(MethodName=="Assign")//if Assign is clicked
        {
        TheApplication().SetProfileAttr("SROldOwner", TheApplication().ActiveBusObject().GetBusComp("Service Request").GetFieldValue("Owner"));
        TheApplication().SetProfileAttr("SRNewOwner", this.BusComp().GetFieldValue("Login"));       
          }
         
    }//end of try
    catch(e)
    {
    //Error Handling Code
    }//end of catch
    finally
    {
    //Destroy Variables
    }//end of finally
    return (ContinueOperation);
}

On InvokeMethod of Assign Method, we can have following code which will create Audit Trail record after assignment is done:

boSR = TheApplication().GetBusObject("Service Request");
bcAudit = boSR.GetBusComp("Audit Trail Item - Data");



        
if(TheApplication().GetProfileAttr("SROldOwner")!=TheApplication().GetProfileAttr("SRNewOwner"))
{
    bcAudit.NewRecord(NewBefore);
    bcAudit.SetFieldValue("Business Component", "Service Request");
    bcAudit.SetFieldValue("Employee Id", TheApplication().LoginId());
    bcAudit.SetFieldValue("Field", "Owner");
    bcAudit.SetFieldValue("Old Value",TheApplication().GetProfileAttr("SROldOwner"));
    bcAudit.SetFieldValue("New Value",TheApplication().GetProfileAttr("SRNewOwner"));
    bcAudit.SetFieldValue("Operation","Modify");            
    bcAudit.SetFieldValue("Table Row Id", TheApplication().ActiveBusObject().GetBusComp("Service Request").GetFieldValue("Id"));
            bcAudit.SetFieldValue("Record Id", TheApplication().ActiveBusObject().GetBusComp("Service Request").GetFieldValue("Id"));
            bcAudit.SetFieldValue("Buscomp Base Table", "S_SRV_REQ");
    bcAudit.SetFieldValue("Date", bcAudit.GetFieldValue("Created"));
    bcAudit.SetFieldValue("Audit Source", "Assignment Manager");
    bcAudit.SetFieldValue("Table Name", "S_SRV_REQ");
    bcAudit.WriteRecord();
}
       
TheApplication().SetProfileAttr("SROldOwner", "");
TheApplication().SetProfileAttr("SRNewOwner", "");

0 comments:

Blogger Widgets