Emails that are recalled should not create a new service request.

Anvesh
Tera Contributor

Emails that are recalled should not create a new service request.

In this circumstance ServiceNow should match the message id to the original email sent and include the recall message in the original service request created.

Ideally, the original service request should automatically be resolved/closed. If this is not possible then the existing system notification to the assignee must be triggered to allow them to manually close the request.

1 ACCEPTED SOLUTION

AirSquire
Tera Guru

Hi Anvesh,

i tried to recall an email from outlook which was previously sent to my PDI(personal developer instance). In the received email at the instance, I found the keyword "Recall" appended or prefixed in my email's subject. I used that and tried to delete the incident created by the accidentally sent mail by matching the subject line. I was successful in this. Therefore if you can fetch the incident created(in my case to delete it) you can update it with whatever value you want using the "email.subject" / "email.body" along with updating the state value of the record. Please find the screenshots and code below:

find_real_file.png

Action Script

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

// get Subject and remove recall by splitting it by ":" 
//as the subject in call mail was "Recall: test mail" 
//and the accidental email's subject was "test mail"
	var sub = email.subject.split(':');

//trim any spaces
	var subject = sub[1].trim();

//gliderecord to find a matching incident with the subject
	var gr = new GlideRecord('incident');
	gr.addQuery('short_description',subject);
	gr.query();
	if(gr.next()){
		gr.deleteRecord();
	}

})(current, event, email, logger, classifier);

Regards
Air

View solution in original post

4 REPLIES 4

AirSquire
Tera Guru

Hi Anvesh,

i tried to recall an email from outlook which was previously sent to my PDI(personal developer instance). In the received email at the instance, I found the keyword "Recall" appended or prefixed in my email's subject. I used that and tried to delete the incident created by the accidentally sent mail by matching the subject line. I was successful in this. Therefore if you can fetch the incident created(in my case to delete it) you can update it with whatever value you want using the "email.subject" / "email.body" along with updating the state value of the record. Please find the screenshots and code below:

find_real_file.png

Action Script

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

// get Subject and remove recall by splitting it by ":" 
//as the subject in call mail was "Recall: test mail" 
//and the accidental email's subject was "test mail"
	var sub = email.subject.split(':');

//trim any spaces
	var subject = sub[1].trim();

//gliderecord to find a matching incident with the subject
	var gr = new GlideRecord('incident');
	gr.addQuery('short_description',subject);
	gr.query();
	if(gr.next()){
		gr.deleteRecord();
	}

})(current, event, email, logger, classifier);

Regards
Air

Anvesh
Tera Contributor

Thanks Air, this is the solution i was looking for.

Hi Anvesh,

I am glad that it helped!!

Regards
Air

Hi Air,

My condition is somewhat different here. I want to update my request if user has recalled and replaced the content of outlook mail. 

 

Pls help.

 

 

Regards,

Nikita