how to add incident number in subject of mail, when email gets triggered from email client.

Alexa alexa
Tera Contributor

Incident number in subject should be readonly for user.

Even if user make changes, if not only then also only incident number should be sent to recipient of the mail.

 

 

 

Thanks in advance.....

1 ACCEPTED SOLUTION

Sure I'll help, but still, I must point out that I think it would be better to teach your users. 🙂

find_real_file.png

Script as follows

(function executeRule(current, previous /*null when async*/) {

	// checks if the subject contains "INC" and if not, try to add the INC-number from matching record
	if (current.getValue('subject').indexOf('INC') == -1) {
		var incGR = new GlideRecord('incident');
		if (incGR.get(current.getValue('instance'))) {
			var incNumber = incGR.getValue('number');
			current.setValue('subject', current.getValue('subject') + ' ' + incNumber);
		}		
	}
})(current, previous);

View solution in original post

5 REPLIES 5

Sure I'll help, but still, I must point out that I think it would be better to teach your users. 🙂

find_real_file.png

Script as follows

(function executeRule(current, previous /*null when async*/) {

	// checks if the subject contains "INC" and if not, try to add the INC-number from matching record
	if (current.getValue('subject').indexOf('INC') == -1) {
		var incGR = new GlideRecord('incident');
		if (incGR.get(current.getValue('instance'))) {
			var incNumber = incGR.getValue('number');
			current.setValue('subject', current.getValue('subject') + ' ' + incNumber);
		}		
	}
})(current, previous);