- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2017 12:05 PM
I'm in the process of refactoring our CTI processing for Istanbul per HI KB0620953 "Ensure a working CTI Integration in preparation for an Istanbul upgrade". The big change is that any inserts, updates or deletes must be performed from a non-client callable script in sys_script (business rules table) while the rest of the CTI processing is in a client callable script in sys_script. The problem I'm having is that the client callable script is getting a 'function not found' error when calling the non-client callable script. Here's the client callable script:
function cti() {
var empNbr = sysparm_caller_id;
var url = 'nav_to.do?uri=new_call.do';
if (empNbr != null && empNbr != '') {
var user = new GlideRecord('sys_user');
user.addQuery('employee_number', empNbr);
user.query();
if (user.next()) {
// it's this statement that fails with function not found
var callSysId = u_CTI_Create_Call(user.sys_id, user.employee_number, user.u_lan_id); // not client-callable per release notes
if (callSysId != null) {
url += '?sys_id=' + callSysId; // set url to open the just created call record
}
}
}
answer = url; return url;
}
The u_CTI_Create_Call is defined as a non-client callable business service on the Global table and is active.
What am I doing wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2017 03:32 PM
I had opened up a HI incident on this issue and just heard back that KB0620953 as well as the comments in the OOTB CTI Processing business rule are in error - the non-client callable function that must be factored out should be a script include and not a global buisness rule (sys_script entry).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 10:09 AM
Were you able to call a non-client callable script include from your CTI business rule function? If so would you please post code. I cannot get that to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 10:14 AM
Gregg,
I was able to get this to work after working with ServiceNow support.
Refer back to https://hi.service-now.com/kb_view.do?sysparm_article=KB0620953 it has been updated with the fix.
You'll need to contact ServiceNow support to get the Evaluator script include as well.
There's one thing that is missing from the documentation as of this post.
You will also need to make your non-client callable script accessible from All application scopes.
Arren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 11:00 AM
Thank you very much! This gives me hope. I opened a HI ticket and will look to get the Evaluator script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 11:05 AM
Also, mention PRB840675 in case that may help speed things along. My incident was attached to that PRB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 09:16 AM
I had also opened a HI incident. When I saw Arren's post above I informed the engineer working the incident of the update and they provided the CTIEvaluator script include and a document on refactoring CTI for Istanbul. I've refactored my code but am still getting an error (note the second line is referring to the CTIEvaluator script include where it evaluates the cal to my scrit include):
Evaluator: java.lang.SecurityException: Illegal access to private script include AvayaIntUtils in scope rhino.global being called from scope rhino.sandbox Caused by error in <refname> at line 1 ==> 1: new AvayaIntUtils().u_CTI_Create_Call()
Evaluator: java.lang.SecurityException: Illegal access to private script include AvayaIntUtils in scope rhino.global being called from scope rhino.sandbox Caused by error in sys_script_include.22893692c3113200eeed99c8d1d3ae7f.script at line 19
Here's the code for my CTI biz rule:
function cti() {
var empNbr = sysparm_caller_id;
var url = 'nav_to.do?uri=new_call.do';
if (empNbr != null && empNbr != '') {
var user = new GlideRecord('sys_user');
user.addQuery('employee_number', empNbr);
user.query();
if (user.next()) {
var ctiArgs = {};
ctiArgs.cti_sys_id = user.sys_id;
ctiArgs.cti_emp_nbr = user.employee_number;
ctiArgs.cti_lan_id = user.u_lan_id;
var ctiEvaluator = new CTIEvaluator("new AvayaIntUtils().u_CTI_Create_Call()", ctiArgs);
var callSysId = ctiEvaluator.evaluate();
if (callSysId != null) {
url += '?sys_id=' + callSysId;
}
}
}
answer = url;
return url;
}
And here's the code for the AvayaIntUtils script include:
var AvayaIntUtils = Class.create();
AvayaIntUtils.prototype = {
u_CTI_Create_Call: function() {
var grCall = new GlideRecord('new_call');
grCall.newRecord();
grCall.caller = sys_id;
grCall.u_employee = employee_number;
grCall.u_lan_id = lan_id;
var callId = grCall.insert();
return callId;
},
type: 'AvayaIntUtils'
};
Apparently somethings not right but I don't see it.