- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 02:26 PM
Hi, could someone help for the below requirement.
we have "Affected CIs" related list which is of table TASK_CI for Change request(change_request). people can add and remove CIs, the requirement is we can't audit if someone delete CIs or Added. we are thinking to put some work_notes at change_request level when someone deletes or add CIs. appreciate if anyone has worked on same scenario or any help.
thanks,
sry
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 03:01 PM
Write a business rule on task_ci table
When: before delete
Conditions: Task.task type is change request
Script:
var chg= new GlideRecord('change_request');
chg.get(current.getValue('task'));
chg.work_notes=current.ci_item.getDisplayValue()+' is no more affected due to this change';
chg.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 03:01 PM
Write a business rule on task_ci table
When: before delete
Conditions: Task.task type is change request
Script:
var chg= new GlideRecord('change_request');
chg.get(current.getValue('task'));
chg.work_notes=current.ci_item.getDisplayValue()+' is no more affected due to this change';
chg.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 09:40 PM
Hi Abhinay, thank you so much for the prompt reply. your solution worked perfectly however i find the worknotes getting too many if i have lots of CIs added. suppose if i have added like 100 CIs and if i remove 50 of them the work_notes really adding 50 entries. can we add just a single worknote entry if i delete multiple CIs!
thanks,
sry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 03:37 PM
I remember the days when I had to do what you're describing to meet compliance requirements. But capturing audit trails in Work Notes is no longer needed as ServiceNow provides the features OOB. To enable it,
- Navigate to System Definition > Dictionary and turn on Audit for the task_ci table (btw, this is a many-to-many table)
- Configure Activities to make sure Configuration item (this is the one CI on the main form) and Relationship Changes (this will show the Affected CIs from the Related List) are selected:
- Then you'll see deletions like below (only deletions are shown since what got added are still in the Affected CIs Related List):
- You can also see these events via the form menu > History > List like below (the Calendar view won't show the changes to Affected CIs):
Hope this helps.
Please feel free to connect, follow, mark helpful / answer, like, endorse.
| John Chun, PhD PMP | ![]() |
Winner of November 2016 Members' Choice Award
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 09:45 PM
Hi John Chun, your solution is also working. but i couldn't find the entries in History--> List.


