3

I am attemping to link our CTI call center calls to a custom object that is a child of Case. The intent is to create a record that contains the Case Id and the CTI Call Id so that our data analysis tools can link comprehensive call and case data for reporting purposes.

To accomplish this, I am trying to use sforce.interaction.runApex() and passing in the name of a web service, method, parameters, and callback. This works fine when I am only passing the Case Id (one parameter) to the web service method, like so:

sforce.interaction.runApex('GlobalWebServicesEx', 'CreateCTILogs',
    'caseid='+cid, callback);

Where cid is the Case Id filled from a parsed JSON string returned by getPageInfo(getPageInfoCallback).

What I really want to do is pass both the Case ID and the CTI Call ID into my web service method, like so:

sforce.interaction.runApex('GlobalWebServicesEx', 'CreateCTILogs', 
    'caseid='+cid, 'callid='+call, callback);

where call is the variable that holds the call id. I have tried different variations of passing the two string parameters to my web service method but it fails every time. I can't seem to get the correct syntax or find an example of passing two parameters into a web service using the runApex() function. If anyone knows how to do this, please show me an example. Thanks.

1 Answer 1

2

As the documentation specifies, you must use a standard URL query string syntax:

sforce.interaction.runApex('GlobalWebServicesEx', 'CreateCTILogs', 
    'caseid='+encodeURIComponent(cid)+'&callid='+encodeURIComponent(call), callback);

Note that you should always use encodeURIComponent to avoid accidental escaping issues with special characters.

1
  • This worked! Thanks so much. You're a life-saver!
    – Joan J.
    Sep 25, 2017 at 15:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .