How to get audit logs for a custom column.

Document ID : KB000014742
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

How to set up to get Audit Logs for a custom field?

Answer:

In order to record audit logs when a custom field is updated, please follow the below steps. In this example, we use a custom column, "ztest01" added to the CR Object.

 

  1. Launch Web Screen Painter and log into it using Service Desk Manager (SDM) Administrator account and launch Schema Designer.

  2. In the Schema Designer, select the custom column, for example, "ztest01" and open 'Advanced' tab.

  3. In the 'site-defined UI_INFO' field, type "AUDITLOG".

    Schema_designer.jpg

  4. Go to 'File' > 'Save and Publish' and close Schema Designer and Web Screen Painter.

  5. Stop the Service Desk Manager service and open the Command Prompt.

  6. Run pdm_publish to take effect the change in Schema Designer.

  7. Start the SDM service and log into SDM using SDM Administrator.

  8. Open 'Administration' tab and go to 'Notifications' > 'Activity Notifications'.

    Activity_Association_01.jpg

  9. Click on <Create New> button and create a new Activity Association for ztest01 column as per the following example. Ensure to turn on the "Log Me" check box.

    Activity_Association_02.jpg

  10. Go to 'Options Manager' > 'Audit Log' and install the audit log options, "audit_upd" and "audit_ins", and restarted the SDM service.

    Options_Manager.jpg

  11. Created a file auditlog_site.mod with the following content and store it under ..\site\mods folder.

    OBJECT cr {
     TRIGGERS {
      // log field changes for custom attributes
      POST_CI audit_fields_site(persistent_id, audit_userid, ref_num, CHANGED_ONLY, ztest01) 51
       FILTER( EVENT("UPDATE(NX_AUDIT_UPD)") );
     };
    };

  12. Save it and restart the SDM service to take effect the changes.
Additional Information: