CTI.do to create case

hakansuri
Kilo Expert

A customer wants a URL base integration with case form.

CTI.do with parameters opens up an incident form.

How can we configure that form that it opens up a case form instead?

Thanks

H

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I believe you can set a script include that controls the behavior of what happens and then call it with a parameter passed to the cti page.



sysparm_cti_rule=name where 'name' is the name of a function to be invoked for CTI processing rather than using the default script. The function must be defined in a sys_script entry marked client callable. If the function needs to insert, update, or delete any GlideRecord(s), it must call a separate non-client callable function to perform the update(s).



Computer Telephony Integration


View solution in original post

10 REPLIES 10

Hi geet,

I've added the below function (BR Script) to CTI Processing BR and use the below URL to trigger my custom script

URL:

https://YourInstance.service-now.com/sysparm_cti_rule=cti_case&sysparm_caller_phone=PhoneNumber

BR Script:

function cti_case() {
var url = null;
var name = sysparm_caller_name;
eid = sysparm_caller_id;
var inputPhone = sysparm_caller_phone;
var phone = '(' + inputPhone.substr(0, 3) + ') ' + inputPhone.substr(3, 3) + '-' + inputPhone.substr(6, 4);
var mobile_phone = phone;
var taskID = sysparm_task_id;
var fQuery = sysparm_query;
if (fQuery == null)
fQuery = '';
var view = sysparm_view;
if (view == null || view == '')
view = "case";

var userID = null;
if (eid != null && eid != '') {
userID = UserGetSysId("employee_number", eid);
}
if (userID == null && name != null && name != '') {
userID = UserGetSysId("name", name);
}
if (userID == null && phone != null && phone != '') {
userID = UserGetSysId("phone", phone);
}
if (userID == null && mobile_phone != null && mobile_phone != '') {
userID = UserGetSysId("mobile_phone", mobile_phone);
}
if (userID != null) {
var gr = new GlideRecord("sn_customerservice_case");
gr.addQuery("active", "true");
gr.addQuery("contact", userID);
gr.setWorkflow(false);
gr.query();
if (gr.next() && gr.getRowCount() == 1)
url = "cti.do?sysparm_task_id=" + gr.sys_id + "&sysparm_view=" + view;
// if (gr.next())
else if(gr.hasNext())
url = "sys_user.do?sys_id=" + userID + "&sysparm_view=" + view;
} else {
if (taskID != null && taskID != '') {
//var task = new GlideRecord('incident');
//task.addQuery('number', taskID);
//task.query();
//if (task.next()) {
//if (typeof(sysparm_work_notes) != 'undefined')
// task.work_notes.setJournalEntry(sysparm_work_notes);
//if (typeof(sysparm_priority) != 'undefined')
// task.priority = sysparm_priority;
//task.update();
//}
url = "cti.do?sys_id=" + taskID + "&sysparm_view=" + view;
}
}
if (userID != null) {
if (fQuery.length > 0)
fQuery += "^";
fQuery += "caller_id=" + userID;
}
if (url == null) {
url = "sn_customerservice_case.do?sys_id=-1";
if (fQuery != null)
url += "&sysparm_query=" + fQuery;
}
answer = url;
return url;
}