HPE Service Manager / Service Center Support and News Forum
Showing results for 
Search instead for 
Do you mean 

Audit Attachment SM 9.21

Frequent Advisor

Audit Attachment SM 9.21

Dear all,

 

I need your help

 

Is it possible to do an audit on attachments, basic informations

 

Who added, when or use a "procedure" that generates a record on "Activities"?

 

Please help me

 

Thank you so very much

___________________
VH
7 REPLIES
HPE Expert

Re: Audit Attachment SM 9.21

Hello Victor,

 

There is actually an Enhancement Request for this that you can check on the following link:

 

http://support.openview.hp.com/selfsolve/document/KM1232242

 

I'll try to find additional information to share with you about this.

 

Regards,

Alex

HP Support
Frequent Advisor

Re: Audit Attachment SM 9.21

Alex,

 

Thanks for collaboration but when I put my login account I received the following message:

 

You are not authorized to view this document

 

Is there other way to share it?

 

Thanks in advance

___________________
VH
Honored Contributor Honored Contributor

Re: Audit Attachment SM 9.21

[ Edited ]

Yeah, this is possible; we built it in our environment though we're logging it an as activity record in each module, instead of an Audit record. I'll share what I did, which might point you in a direction if you truly want this to be on an Audit record.

 

First, we added a script to the ScriptLibrary that gets called whenever an attachment is added to a record or removed from a record (see attached). Basically, the Javascript populates some variables with the name of the attachment, and whether the attachment was added or removed. Then, it checks the Object record for the record where the file is attached to figure out if activities are tracked, and if they are, what table is used to track the activities. Then it simply triggers the sc.activity RAD application to check the activityactions table to determine whether or not to add an activity.

 

Next, we added activityaction records for each modules where we want to track the attachments; for example, in the Incident Management module, we added:

Name: Update Activities

Table: probsummary

Mode: update

Condition: true

 

Name: Attachment Added

Condition: $cg.attachment.added

Description: {"Attachment \""+$cg.attachment.name+"\"" has been added."}

 

Name: Attachment Removed

Condition: $cg.attachment.removed

Description: {"Attachment \""+$cg.attachment.name+"\"" has been removed."}

 

 

Then, we added two triggers on the SYSATTACHMENT table - one for when an attachment is added, one for when it is removed - that calls the script in the Script Library

 

Trigger Name: cg.activity.track.after.add

Table Name: SYSATTACHMENTS

Trigger Type: 2 - After Add

Script -

if (record.segment==0){

  lib.cg_trigger_attachment_activity.add(record)

}

 

--------------

Trigger Name: cg.activity.track.after.delete

Table Name: SYSATTACHMENTS

Trigger Type: 6 - After Delete

Script -

if (record.segment==0){

  lib.cg_trigger_attachment_activity.remove(record)

}

 

 

Honored Contributor Honored Contributor

Re: Audit Attachment SM 9.21

[ Edited ]

Forgot to attach my javascript

Script name: cg_trigger_attachment_activity

 

function add(record){
 fileName=record.application
 uniqueId=record.topic
 vars.$cg_attachment_name=record.filename
 var recObject = new SCFile("Object")
 var getObject = recObject.doSelect("file.name=\""+fileName+"\"")
 
 if (getObject==RC_SUCCESS){
  vars.$cg_attachment_added=true
  uniqueField=recObject.unique_field[0]
  
  ticket = new SCFile(fileName)
  getTicket = ticket.doSelect(uniqueField+"=\""+uniqueId+"\"")
  if (getTicket==RC_SUCCESS){
   
   var retCode
   system.functions.rtecall("callrad", retCode, "sc.activity", ["file", "second.file", "text", "record"], [ticket, ticket, "update", recObject], false)
   vars.$cg_attachment_added=""
  }
 }

function remove(record){
 fileName=record.application
 uniqueId=record.topic
 vars.$cg_attachment_name=record.filename
 var recObject = new SCFile("Object")
 var getObject = recObject.doSelect("file.name=\""+fileName+"\"")
 
 if (getObject==RC_SUCCESS){
  vars.$cg_attachment_removed=true
  uniqueField=recObject.unique_field[0]
  
  ticket = new SCFile(fileName)
  getTicket = ticket.doSelect(uniqueField+"=\""+uniqueId+"\"")
  if (getTicket==RC_SUCCESS){
   
   var retCode
   system.functions.rtecall("callrad", retCode, "sc.activity", ["file", "second.file", "text", "record"], [ticket, ticket, "update", recObject], false)
   vars.$cg_attachment_removed=""
  }
 }

Regular Advisor

Re: Audit Attachment SM 9.21

Hello Jacob,

 

Sorry for the intervention in the existing thread. But, your solution really workedfor me.

Thanks a ton!!!

But, I need the same thing for updating any attachment also.

This is my client's requirement & I am new in this field. So, pls give me the reply........

 

 

Thanks and Regards,

Avijit Chatterjee

Regular Advisor

Re: Audit Attachment SM 9.21

Hello Everybody,

 

Good Evening!!!

Please give me any reply as this is really very urgent for me..

Please reply.....

 

Regards,

Avijit

Highlighted
Trusted Contributor

Re: Audit Attachment SM 9.21

Hi Experts,

 

I am also having the same issue. I am getting stuck while updating any attachment.

 

Please suggest a solution....

 

 

Regards,

Sanjeev