function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
James Cotterell 5James Cotterell 5 

RunApex missing method parameter with ClickToDial on objects with special characters in the name

I am using a custom console component that listens to ClickToDial events and calls the sforce.interaction.runApex method from the openCTI API.
   
sforce.interaction.cti.onClickToDial(function(clickToDialResponse) {
	if (clickToDialResponse.error) {
		console.log(clickToDialResponse.error);
		return;
	}
	
	sforce.interaction.runApex('ClickToDialHandler', 'HandleClickToDial', 'clickToDialResultJson=' + clickToDialResponse.result, function(response) {
		if (response.error) {
			console.log(response.error);
			return;
		}
		
		//else do something with response.result
	}
};

One of the parameters I am passing to my Apex method is the name of the object the ClickToDial was initiated from (as found in the JSON from the ClickToDial event).

If I initiate a ClickToDial from an object with '&' in the name, I see a missing method error in the browser development tools console.

Error seen in Chrome DevTools

The runApex call uses a POST to Salesforce, and all the parameters appear to be url encoded. Is there something I can do to fix this, or is this a bug with Salesforce?