- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-17-2020 07:09 AM
Hello,
I have an inbound action rule that is properly finding and updating my incident but two things are missing.
1 the target is empty on the email log.
2. the email doesn't get attached to the incident as email received.
///----------------------------------------------------------
gs.include('validators');
var incNum = email.subject.substring(32,42); //get incident number from email subject
if((email.subject.indexOf("Received") > -1) ) 
{
var incident_num_rec = new GlideRecord('incident'); 
 incident_num_rec.addQuery();
 incident_num_rec.addQuery('number', incNum); 
 incident_num_rec.query(); 
if(incident_num_rec.next())
{
 incident_num_rec.work_notes = "An email was received from Ricoh Support and forwarded to this ticket";
 incident_num_rec.comments = "A Ricoh support call has been opened";
 incident_num_rec.u_fournisseur_externe = "Ricoh";
 incident_num_rec.state = 3;
 incident_num_rec.hold_reason = 4; 
 incident_num_rec.update();
}
}
else
{
 state = stop_processing;
///----------------------------------------------------------
Any help would be appreciated.
Thanks,
MjF
Solved! Go to Solution.
- Labels:
 - 
						
							
		
			Incident Management
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-17-2020 08:25 AM
After reviewing a dozen times I realized you wanted my gr.  Updated the lines:
 sys_email.target_table = "incident";
 sys_email.instance = incident_num_rec.sys_id;
 sys_email.update();
and it DOES ATTACH MY EMAIL.
Thank you 
MjF
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-17-2020 07:22 AM
HI,
Can you try this line of code in your if loop:
sys_email.target_table = "incident";
sys_email.instance = gr.sys_id;
sys_email.update();
Thanks,
Ashutosh
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-17-2020 07:27 AM
HI,
If you have a ticket number in subject line then it should automatically set that.
Thanks,
Ashutosh
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-17-2020 08:08 AM
Hey, that's what I thought, but its not capturing the number from subject on these emails. Thats why I did the 'email.subject.substring(32,42)' to hard code it.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-17-2020 08:12 AM
Hey, 
I added those 3 lines after 'incident_num_rec.update();' and it produced the same thing.  Updated the ticket fine but no email received and now the target is Null instead of (empty).
Thanks,
MjF
