New ServiceNow Admin Role

TristanaN
Tera Contributor

Hello all.

 

I am new to taking on an active Admin role for ServiceNow, and I want to make sure that I have thought of everything and looking for a little bit of help.

  • I have several requests that are stuck in an open status.
  • I would like to do a mass closure, but due to the age of the requests, I don't want the closure email to be sent.
  • Looking for steps to disable the email notifications for this minutes long process, and then re-enable them?

Any assistance would be appreciated.

1 ACCEPTED SOLUTION

bmazzei
Tera Expert

TristanaN,

 

I have not been an admin very long but you could stop the follow of outbound Emails by doing the following:

 

All - system Properties - Email Properties

Remove the check for Email sending enabled or have them set to a mail box of your choice in the box below.

 

It will effect all emails at the time the property is set so you might want to execute after hours.

 

Good Luck,

Ben

View solution in original post

7 REPLIES 7

Colin Wilson
Giga Guru

This is a fix script we used to do a similar thing, closing out a bunch of super old Requested Items that were left open due to failed workflow contexts, etc. 

 

updateReq();

function updateReq(){
	
	var query = 'pasteYourEncodedQueryHere';
	var rec = new GlideRecord('sc_req_item');
	rec.addEncodedQuery(query);
	//rec.setLimit(10);
	rec.query();
	while (rec.next()){
		rec.active = 'false';
		rec.state = 3;
//rec.stage ='Closed Complete';
		rec.setWorkflow(false);
		rec.autoSysFields(false);
		rec.update();
	}
	
}

 

 Use this as a jumping point, and feel free to customize it and tailor it to your needs. If you don't understand a line of code, it should be googleable or documented in developer.servicenow.com / docs.servicenow.com / the community forums. 

as always - don't run this in a PROD instance without testing it in a Sub Prod instance. Fix Scripts can be VERY dangerous. I always recommend that the 'record for rollback' checkbox is checked.

 

edit: as prasad48 mentioned, the rec.setWorkFlow(false); line will stop any workflows, business rules, events from processing as a result of the change made by rec.update(). So - the event that fires the notification won't fire. 

Sandeep Rajput
Tera Patron
Tera Patron

@TristanaN You can identify the notifications which are being used when the request is closed. Before running your script to mass closure your request, you can choose to set the active field on these notification to false. You can again set these notifications to active true once you are done closing the request in bulk.

 

Hope this helps.

TristanaN
Tera Contributor

Thanks to all the replies and suggestions. I'll give each of them a try and find where my comfort level is for each. Much appreciated!