Hi.
attached is a so called fragment file , a script which can be executed by the fragment interpreter bop_cmd
the script implements the function cancel_evt.
It has three input parameters:
- factory : the ticket factrory you want to work on ('cr','chg','iss' and 'wf' are supported).
- where_clause : a so called majic where_clause, to fetch the tickets in scope.
- doit : a flag, when set to 1 , the script will cancel all SLA events for each ticket found by the whereclause.
if set to 0: no changes are done by the script.
the script prints the ticket number of each ticket found which has attached SLA events.
It also prints the current status of each event.
ticket numbers of tickets which don't have attached SLA events are collected and skipped, but printed at the end of the script.
As long this script is excuted with doit=0, nothing will be changed in the system, but you will get printout of what this script finds.
For example if you want to work on active incidents with with priority=3 you might execute
bop_cmd -f cancel_evt.frg "cancel_evt('cr','type=\'I\' and active=1 and priority.sym=\'3\'',0)"
The output should look similar to
found 'cr' '110 with 3 events
atev.id=400452 group_name=SLA Status=Fired
atev.id=400455 group_name=SLA Status=Fired
atev.id=400456 group_name=SLA Status=Fired
found 'cr' '122 with 8 events
atev.id=400654 group_name=SLA Status=Cancelled
atev.id=400657 group_name=SLA Status=Cancelled
atev.id=400658 group_name=SLA Status=Cancelled
atev.id=400664 group_name=SLA Status=Fired
atev.id=400665 group_name=SLA Status=Waiting
atev.id=400666 group_name=SLA Status=Waiting
atev.id=400667 group_name=SLA Status=Waiting
atev.id=400668 group_name=SLA Status=Waiting
Skipped Objects :28, 32, 35, 36, 38, 40, 42, 43, 44, 54, 55, 89, 92, 102, 103
when executing the same with doit=1
bop_cmd -f cancel_evt.frg "cancel_evt('cr','type=\'I\' and active=1 and priority.sym=\'3\'',1)"
The output looks like
found 'cr' '110 with 3 events
atev.id=400452 group_name=SLA Status=Fired
atev.id=400455 group_name=SLA Status=Fired
atev.id=400456 group_name=SLA Status=Fired
found 'cr' '122 with 6 events
atev.id=400654 group_name=SLA Status=Cancelled
atev.id=400657 group_name=SLA Status=Cancelled
atev.id=400658 group_name=SLA Status=Cancelled
atev.id=400664 group_name=SLA Status=Fired
atev.id=400667 group_name=SLA Status=Cancelled
atev.id=400668 group_name=SLA Status=Cancelled
Skipped Objects :28, 32, 35, 36, 38, 40, 42, 43, 44, 54, 55, 89, 92, 102, 103
For sure , you should make a backup of your DB before setting doit=1 !
Hope this helps somehow. If stuff is missing or doesn't work as expected, let me know.
Regards
............Michael