• James Cotterell 5
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I have a custom Visualforce page as a Publisher Action that looks like this:
 
<apex:page controller="PageController" action="{!Init}" >

	<apex:includeScript value="/support/console/31.0/integration.js" /> 
	<apex:includeScript value="https://code.jquery.com/jquery-1.7.1.js" />
    
	<apex:form>
        
        <apex:actionFunction action="{!Init}" name="refresh" reRender="ContainerToBeRefreshed"/>
		
		<apex:outputPanel id="ContainerToBeRefreshed" layout="block">
			...
		</apex:outputPanel>
		
	</apex:form>
		
	<script type="text/javascript">
	$(function(){
		function eventHandler(msg){
			var focusedPrimaryTabId = msg.message;
			sforce.console.getEnclosingPrimaryTabId(function(result){
				var enclosingPrimaryTabId = result.id;                   
				if(focusedPrimaryTabId === enclosingPrimaryTabId){                       
					refresh();
				}
			});                
		};
		sforce.console.addEventListener('EventName', eventHandler);
		
		sforce.console.onFocusedSubtab( function ( result ) {        
			refresh();
		});
    });
	</script>
	
</apex:page>

Previously this enabled me to dynamically refresh the visualforce page when the user switched between (primary or sub) tabs in Service Console.

This no longer works. On loading the publisher action I see the following message written to the developer console from ServiceDesk.js.

addEventListener: Unsupported Operation: This API cannot be used on this component.

Is the API no longer available for use within a publisher action? Or is there an alternative way to do this?
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?
I have a custom Visualforce page as a Publisher Action that looks like this:
 
<apex:page controller="PageController" action="{!Init}" >

	<apex:includeScript value="/support/console/31.0/integration.js" /> 
	<apex:includeScript value="https://code.jquery.com/jquery-1.7.1.js" />
    
	<apex:form>
        
        <apex:actionFunction action="{!Init}" name="refresh" reRender="ContainerToBeRefreshed"/>
		
		<apex:outputPanel id="ContainerToBeRefreshed" layout="block">
			...
		</apex:outputPanel>
		
	</apex:form>
		
	<script type="text/javascript">
	$(function(){
		function eventHandler(msg){
			var focusedPrimaryTabId = msg.message;
			sforce.console.getEnclosingPrimaryTabId(function(result){
				var enclosingPrimaryTabId = result.id;                   
				if(focusedPrimaryTabId === enclosingPrimaryTabId){                       
					refresh();
				}
			});                
		};
		sforce.console.addEventListener('EventName', eventHandler);
		
		sforce.console.onFocusedSubtab( function ( result ) {        
			refresh();
		});
    });
	</script>
	
</apex:page>

Previously this enabled me to dynamically refresh the visualforce page when the user switched between (primary or sub) tabs in Service Console.

This no longer works. On loading the publisher action I see the following message written to the developer console from ServiceDesk.js.

addEventListener: Unsupported Operation: This API cannot be used on this component.

Is the API no longer available for use within a publisher action? Or is there an alternative way to do this?