Problem calling a non-client callable script from a client-callable script

stevehuitt
Kilo Guru

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?

1 ACCEPTED SOLUTION

stevehuitt
Kilo Guru

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


View solution in original post

21 REPLIES 21

Confirm that your script include is not client callable and change 'Accessible from' to all application scopes.   I have it working on our environment, so for sure it works.   We are able to create an incident, write to the log, and do gs.addInfoMessage.  



Thank you again to Arren for getting us going in the right direction.


Thanks you Arren and Gregg! I changed the script include to be callable from all application scopes and now it's working as expected.