- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 04:31 AM
Hi All,
We had a requirement on Email to ticket Integration. Here, we have to assign the ticket to a assignment group based on the substring in the email subject.
Ex: LCI1 Job NTM6839W (JOB09692), has failed @ 06:08:10 19 Mar 2018
Here, "NTM" is considered as mnemonic and based on that we have to assign the ticket to a assignment group.
We have created a custom table with mnemonics and assignment groups and GlideRecord this table in Inbound email action which is not working.
Below is the how we are querying the table:
current.caller_id = gs.getUserID();
current.u_impacted_id = gs.getUserID();
var str = email.subject.substring(8, 12).toString();
var gr = new GlideRecord('u_tws_integration');
gr.addQuery('u_mnemonics','str');
gr.query();
if(gr.next())
{
gs.log(str,'tws');
gs.log(gr.u_group,'tws');
current.assignment_group = gr.u_group;
}
else
{
current.assignment_group = 'c18c447ddb4d2e0006a6f9b9af961920';
}
Can someone help me on the above issue.
Thanks in Advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 05:20 AM
Change
var str = email.subject.substring(8, 12).toString();
line to
var str = email.subject.substring(9, 12).toString();
and check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 05:08 AM
Hi Mihir,
I am using the current.insert() operation to insert the incident record.
Below is the my complete Inbound action script
current.caller_id = gs.getUserID();
current.u_impacted_id = gs.getUserID();
var str = email.subject;
var str1= str.substring(8, 12).toString();
var gr = new GlideRecord('u_tws_integration');
gr.addQuery('u_mnemonics',str1);
gr.query();
if(gr.next())
{
current.assignment_group = gr.u_group;
}
else
{
current.assignment_group = 'c18c447ddb4d2e0006a6f9b9af961920';
}
current.location = current.caller_id.location;
current.u_location_type = '';
current.category='';
current.subcategory='';
current.cmdb_ci = '';
current.description = "received from: " + email.origemail + "\n\n" + email.body_text;
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
current.incident_state = IncidentState.NEW;
current.notify = 2;
current.contact_type = "email";
if (email.importance != undefined) {
if (email.importance.toLowerCase() == "high")
current.priority = 1;
}
current.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 05:20 AM
Change
var str = email.subject.substring(8, 12).toString();
line to
var str = email.subject.substring(9, 12).toString();
and check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 06:03 AM
It worked like a Charm!!
Thank you