Add Log Entry for Updates to Custom Fields

From SDU
Revision as of 08:32, 29 November 2010 by Kimmo (Talk | contribs) (Undo revision 4184 by Agegeleruvy (Talk))

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

This article provides instructions for adding entries to the activity log when updates occur to custom fields.

Procedures

Step 1 .Create Activity Associations

  1. Login as admin
  2. Open Notification setup > Activity Associations.
  3. Click on Create New.
  4. Enter the custom field name in the symbol text box(zcustomfield1).
  5. Enter a code in the code text box (custom)
  6. Choose the object type from the drop-down box (Change/isssue/request/wf/..).
  7. Enter a description of the field (The MCC Application Code field on a Request).
  8. Enter the custom attribute name (zcustomfield1).
  9. Enter the activity type. You can use "Field Update" or you can create a new activity type if you need to specify notifications for the activity type you select. (Field Update).
  10. Check the "Log Me" checkbox.
  11. click Save.

Step 2. Create the trigger

This step is to create the trigger that will initiate the script. The methods used to implement the trigger vary based on the Service Desk release.

For r11.x releases triggers are created via the Schema Designer utility. Simply add the following code as a Site-Defined Trigger to the cr (Request), chg (Change Order), or iss (Issue) table.

POST_CI val_fieldupdate_site(persistent_id, audit_userid, CHANGED_ONLY, customfield1, customfield2, customfield3) 111 FILTER(EVENT("UPDATE"));

For older releases triggers are made by creating a .mod file and placing it in the $NX_ROOT/site/mods/majic directory. Name the .mod anything you like, but it is recommended that it be preceded with a 'z'.

MODIFY cr POST_CI val_fieldupdate_site(persistent_id, audit_userid, CHANGED_ONLY, customfield1, customfield2, customfield3) 111 FILTER(EVENT("UPDATE"));
MODIFY chg POST_CI val_fieldupdate_site(persistent_id, audit_userid, CHANGED_ONLY, customfield1, customfield2, customfield3) 111 FILTER(EVENT("UPDATE"));
MODIFY iss POST_CI val_fieldupdate_site(persistent_id, audit_userid, CHANGED_ONLY, customfield1, customfield2, customfield3) 111 FILTER(EVENT("UPDATE"));

Step 3. Publish the Schema changes

The methods used to publish schema changes vary based on the Service Desk release.

For r11.x releases, follow these steps:

  1. Save your Schema changes
  2. Stop the Service Desk service
  3. Run pdm_publish from a command line
  4. Start the Service Desk service

For older releases recycle the Service Desk service.