email.subject.indexOf not populating Assignment group through inbound actions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 02:03 PM
Hi All,
I am working on Inbound actions script and as per the test when I am getting the subject carried to the script the subject is getting replicated to the incident but the assignment group is left empty.
function updateINC(inc){
var NC = new GlideRecord('incident_task'); //incident_task
NC.addQuery('incident', inc);
NC.query();
while (NC.next()){
NC.short_description = email.subject;
if (email.subject.indexOf("Closed Complete") >= 0)
{
current.assignment_group = '8a5055c9c61122780043563ef53438e3'; //Hardware
}
else
{
current.assignment_group= 'd625dccec0a8016700a222a0f7900d06'; //ServiceDesk
}
current.insert();
}
}
Any suggestions please
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 02:39 PM
Hello,
Please use appropriate logging to see what is going on. If no assignment group is getting set, even with an if/else statement, it may be because it never entered your while loop...which could mean the "inc" parameter you passed in to the function is not correct or not a sys_id or something.
You'd need to review your script and logging for more information.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 02:45 PM
Why have you switched to current.assignment_group rather than NC.assignment_group? You also shouldn't need current.insert() if this is new email (rather and reply or forward).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 03:12 PM
function updateINC(inc){
var NC = new GlideRecord('incident'); //incident_task
NC.addQuery('incident', inc);
NC.query();
while (NC.next()){
NC.short_description = email.subject;
if (email.subject.indexOf("Closed Complete") >= 0)
{
NC.assignment_group = '8a5055c9c61122780043563ef53438e3'; //Hardware
}
else
{
NC.assignment_group= 'd625dccec0a8016700a222a0f7900d06'; //ServiceDesk
}
}
}
not working as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 03:27 PM
function updateINC(inc){
var NC = new GlideRecord('incident'); //incident_task
NC.addQuery('incident', inc);
NC.query();
while (NC.next()){
NC.short_description = email.subject;
if (email.subject.indexOf("Closed Complete") >= 0)
{
NC.assignment_group = '8a5055c9c61122780043563ef53438e3'; //Hardware
}
else
{
NC.assignment_group= 'd625dccec0a8016700a222a0f7900d06'; //ServiceDesk
}
}
}
not working. Any suggestion please