Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add work_notes when affected CI's got deleted

sry
Giga Guru

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

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

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();


View solution in original post

13 REPLIES 13

No John, please see the date. I have removed a CI today on 12/30, this is showing in activity but not in history. see there is no entry for 2016-12-30. yesterday while i was trying with Abhinay's business rule, it recorded those histories 2016-12-29.



so literally the one i have removed on 2016-12-30 is there in activity but not in history-->list.



4.png



thanks,


sry


Can you type "sys_audit.list" in the Navigator filter and hit Enter? Then can you locate the record for the deleted CI Affected from today and post the screenshot? Let's make sure it's in the sys_audit table.


Hi John, i have checked the table "sys_audit_delete" table and verified this deleted record is there. below is the screen shot. unfortunately "sys_audit" table is so huge and i was not able to verify it from that table.


5.png


thanks,


sry


That's one step forward. If you want to troubleshoot History > List, locating this in sys_audit would be more definitive. Can you apply filters to quickly locate the record, say Created on Today?