Assigned_to is inactive, make the assigned to as blank for Open Tickets

atul_05
Tera Contributor

If the Assigned to is Inactive, then make the assigned to as blank.

Need this for all the Open Active tickets including Incidents, tasks, Problem, RITM's

 

Can you please help me achieve this. Do we have to create a Flow or it can be done using BR.

Please provide the Flow or the script for this.

 

1 ACCEPTED SOLUTION

@atul_05 Then you can create this as a scheduled job and run on a daily basis. This way the ticket will get updated on a daily basis. 

 

Here is the filter I created for the script on the task table.

 

Screenshot 2024-07-09 at 4.19.12 PM.png

 

Here is the script I wrote to fix the records.

 

var glideTask = new GlideRecord('task');
glideTask.addEncodedQuery('active=true^sys_class_name=problem^ORsys_class_name=incident^ORsys_class_name=sc_task^ORsys_class_name=sc_req_item^assigned_to.active=false');
glideTask.query();
while(glideTask.next()){
	glideTask.setValue('assigned_to','');
	glideTask.update();
}

 

You can put this script inside a fix script or a scheduled job.

 

Please make sure to test this script on a non prod instance first, verify the result and then run it on a prod instance.

 

Please mark the response helpful and accepted solution if it managed to address your question.

View solution in original post

5 REPLIES 5

@atul_05 You need to choose option C

c.Automatically run a script of your choosing.

 

A scheduled job can be run On Demand or it can run automatically at a specific interval (every minute/hour/daily/weekly/monthly etc.)

 

Please refer to https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/reference-pa... for more information.

 

Please mark the response helpful and accepted solution if it managed to address your question.