Inbound Action: Did not create or update incident using current

Admin7267
Kilo Sage

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".

1 ACCEPTED SOLUTION

Admin7267
Kilo Sage

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());
}

 

View solution in original post

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

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.

Narsing1
Mega Sage

gs.nil is used to check whether the Object is nul/not

In this case, try with JSUtil.nil()

 

Thanks,

Narsing

Admin7267
Kilo Sage

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());
}