did not create or update incident using current Issue

Nikita35
Kilo Guru

hello,

I have written two inbound actions on tables - incident and u_new_call

Please find the script( This is same for both only written on different tables )

current.short_description = 'Callback request submitted via Voicemail';
current.description = 'Please listen to the voicemail.\n\n' + email.body_text + '\n\n Once called change the log type to denote that follow up was made';
current.u_contact_phone_number = findContactPhone(email.subject);
current.contact_type = 'Callback';
current.assignment_group = new ScriptIncludeName().byPassingName('Group name'); // Script include and group name changed with Generic names
current.insert();

function findContactPhone(subjectLine){

var phoneNumber = /\d+/g.exec(subjectLine);
return phoneNumber.toString();
}

Both new call record and incident is not getting created giving below message:

ServiceDesk New Call Callback : did not create or update u_new_call using current

ServiceDesk New Incident Callback : did not create or update incident using current

How can i resolve this issue?

1 ACCEPTED SOLUTION

Hi Nikita,

when match not found it returns null and hence breaking

we can handle this as below

current.short_description = 'Callback request submitted via Voicemail';
current.description = 'Please listen to the voicemail.\n\n' + email.body_text + '\n\n Once called change the log type to denote that follow up was made';

var subjectLine = email.subject;

var phoneNumber = subjectLine.match(/[+](1-)(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}/);

// check if not null
if(phoneNumber!=null){

current.u_contact_phone_number = phoneNumber[0]; // using the 1st array element

}

current.contact_type = 'Callback';
current.assignment_group = current.assignment_group = new ScriptIncludeName().byPassingName('Group name');
current.insert();

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

20 REPLIES 20

Ankur Bawiskar
Tera Patron

Hi Nikita,

Is it working fine without calling the script include for group?

current.short_description = 'Callback request submitted via Voicemail';
current.description = 'Please listen to the voicemail.\n\n' + email.body_text + '\n\n Once called change the log type to denote that follow up was made';
current.u_contact_phone_number = findContactPhone(email.subject);
current.contact_type = 'Callback';
current.assignment_group = 'groupSysId1'; // give hard coded sys_id of group here
current.insert();

function findContactPhone(subjectLine){

var phoneNumber = /\d+/g.exec(subjectLine);
return phoneNumber.toString();
}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I just gave a try:

current.short_description = 'Callback request submitted via Voicemail';
current.description = 'Please listen to the voicemail.\n\n' + email.body_text + '\n\n Once called change the log type to denote that follow up was made';
current.u_contact_phone_number = findContactPhone(email.subject);
current.contact_type = 'Callback';
current.assignment_group = 'a1dede2ddb7e678077cdda654b9619bc';
current.insert();

function findContactPhone(subjectLine){

var phoneNumber = /\d+/g.exec(subjectLine);
return phoneNumber.toString();
}

 

here is the same response in log : 

ServiceDesk New Incident Callback : did not create or update incident using current

Ankur,

 

I did this change and it created the Incident:

current.short_description = 'Callback request submitted via Voicemail';
current.description = 'Please listen to the voicemail.\n\n' + email.body_text + '\n\n Once called change the log type to denote that follow up was made';
//current.u_contact_phone_number = findContactPhone(email.subject);
current.contact_type = 'Callback';
current.assignment_group = new getGroupIDofGroupName_p66().byPassingName('SN_SD_GLOBAL_SVCDESK_CALLBACKS');
current.insert();

//function findContactPhone(subjectLine){

//var phoneNumber = /\d+/g.exec(subjectLine);
//return phoneNumber.toString();
//}

 

So something wrong with the function.

Ankur,

I did below change and it worked - created an Incident.

current.short_description = 'Callback request submitted via Voicemail';
current.description = 'Please listen to the voicemail.\n\n' + email.body_text + '\n\n Once called change the log type to denote that follow up was made';
//current.u_contact_phone_number = findContactPhone(email.subject);
current.contact_type = 'Callback';
current.assignment_group = new ScriptIncludeName().byPassingName('Group name'); // Script include and group name changed with Generic names
current.insert();

/*function findContactPhone(subjectLine){

var phoneNumber = /\d+/g.exec(subjectLine);
return phoneNumber.toString();
}*/

 

Hence something wrong with the function and this statement - current.u_contact_phone_number = findContactPhone(email.subject);