- 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 04:33 AM
HI,
Issue with the line no 5 in your script:
gr.addQuery('u_mnemonics','str'); Please replace the code with below
gr.addQuery('u_mnemonics',str);//Str is a variable and hence it should not be in quotes.
Regards,
Ram M

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 04:36 AM
Hi,
See below code:
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';
}
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 04:46 AM
I tried with the above script but still it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 04:58 AM
Line 5 of your script should be gr.addQuery('u_mnemonics',str);
And
You have to use current.insert() or current.update() method based on your requirement.
Please go through the below link for reference.
Thanks,
Mihir