- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 08:58 AM - edited 01-03-2024 09:13 AM
I have created the inbound email action that when user from assignment group replied to the email of INC created, then assign that INC to him. Below is the script of the same
var subj = current.email.subject;
var bodytxt = current.email.body_text;
if((subj.toLowerCase().startsWith('tst')) || (bodytxt.toLowerCase().startsWith('tst'))){
if(!gs.nil(current.assignment_group) && gs.nil(current.assigned_to) && gs.getUser().isMemberOf(current.getValue('assignment_group'))){
current.assigned_to = gs.getUserID();
current.update();
}
}
Email logs is showing as "Update Incident - Assigned to : did not create or update incident using current".
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:35 PM - edited 01-04-2024 10:37 PM
Fixed the issue
var keyword = 'tst';
if (startsWithIgnoreCase(email.subject, keyword) || startsWithIgnoreCase(email.body_text, keyword)) {
if(!gs.nil(current.assignment_group) && gs.nil(current.assigned_to) && gs.getUser().isMemberOf(current.getValue('assignment_group')) ){
gs.info('Subject or body starts with tst...');
current.assigned_to = gs.getUserID();
current.work_notes = "Update from the inbound email action";
current.update();
}
}
function startsWithIgnoreCase(str, prefix) {
return str.toLowerCase().startsWith(prefix.toLowerCase());
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 09:14 AM
I dont think gs.getUserID() or gs.getUser() will work. You need to get the email id of the from user and get his user account, for example get the email.origemail and then query user table to get the user info and then use in the script.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 10:05 AM
gs.nil is used to check whether the Object is nul/not
In this case, try with JSUtil.nil()
Thanks,
Narsing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:35 PM - edited 01-04-2024 10:37 PM
Fixed the issue
var keyword = 'tst';
if (startsWithIgnoreCase(email.subject, keyword) || startsWithIgnoreCase(email.body_text, keyword)) {
if(!gs.nil(current.assignment_group) && gs.nil(current.assigned_to) && gs.getUser().isMemberOf(current.getValue('assignment_group')) ){
gs.info('Subject or body starts with tst...');
current.assigned_to = gs.getUserID();
current.work_notes = "Update from the inbound email action";
current.update();
}
}
function startsWithIgnoreCase(str, prefix) {
return str.toLowerCase().startsWith(prefix.toLowerCase());
}