diff --git a/Server-Side Components/Business Rules/Track Tag Removal Using Delete Business Rule/BusinessRule.js b/Server-Side Components/Business Rules/Track Tag Removal Using Delete Business Rule/BusinessRule.js new file mode 100644 index 0000000000..c1bf98e00f --- /dev/null +++ b/Server-Side Components/Business Rules/Track Tag Removal Using Delete Business Rule/BusinessRule.js @@ -0,0 +1,14 @@ +(function executeRule(current, previous /*null when async*/ ) { + /* + Fire this BR when a tag is removed/deleted from a record. + Retrieve the tag name, the user who removed the tag, and the tag removal date. + Update the above information onto the tag-referenced record in this example, In this example its incident record + */ + var updateRecord = new GlideRecord(current.table); + if (updateRecord.get(current.table_key)) { + var notes = "Tag Name:" + " " + current.label.getDisplayValue() + "\n" + "Tag Removed By:" + " " + current.sys_updated_by + "\n" + "Tag Removed On:" + " " + current.sys_updated_on; + //updateRecord.setValue("work_notes", notes); + updateRecord.work_notes = notes; + updateRecord.update(); + } +})(current, previous); diff --git a/Server-Side Components/Business Rules/Track Tag Removal Using Delete Business Rule/readme.md b/Server-Side Components/Business Rules/Track Tag Removal Using Delete Business Rule/readme.md new file mode 100644 index 0000000000..e7e62a3022 --- /dev/null +++ b/Server-Side Components/Business Rules/Track Tag Removal Using Delete Business Rule/readme.md @@ -0,0 +1,17 @@ +**Configure the following business rule on the label_entry table:** + +1.Ensure the "Delete" operation is selected and the rule runs onBefore. + +2.Retrieve the table name where the tag is removed. + +3.Update the worknotes to track who removed the tag and when it was removed. +image +image + + +**Output:** + +image + +image +