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 

Is the Console Integration Toolkit available inside a publisher action

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?
Best Answer chosen by James Cotterell 5
James Cotterell 5James Cotterell 5
@Jatin, we have solved this issue using the Canvas SDK Publisher JS API here: http://www.salesforce.com/us/developer/docs/case_feed_dev/Content/case_feed_dev_guide_component_interactions.htm

I have a Custom Console Component that calls this function to send a message to the Publisher Action.
Sfdc.canvas.publisher.publish({name: "publisher.customActionMessage", payload: {actionName: "MyNamespace__My_Custom_Action", message: "My Custom Message"}});

And the VF page for my Publisher Action has this:
<script>
$(function(){
	Sfdc.canvas.publisher.subscribe([{name : "publisher.customActionMessage", onData : function(e) {
		if (e.message === "My Custom Message") {
			//do something
		}
	}}]);
});
</script>

This seems to be working quite well for us so far. Hope it helps.
 

All Answers

ShashankShashank (Salesforce Developers) 
This may have to be investigated further. Please raise a developer support case with salesforce. If you do not have premier support to raise a developer support case, please let me know.
James Cotterell 5James Cotterell 5
Thanks for getting back to me Shashank. I don't currently have premier support so am unable to raise a developer support case.
Jatin Jain 11Jatin Jain 11
@James, @Shashank : Do you have any updates on this. We too facing this issue in spring 15 sandboxes. It was working well with Winter 25 though
Jatin Jain 11Jatin Jain 11
typo: winter15 *
ShashankShashank (Salesforce Developers) 
Hi James,

Please email me at ssrivatsavaya@salesforce.com with your org id (cannot be a developer edition org), detailed steps to replicate the issue.

Thanks,
Shashank
James Cotterell 5James Cotterell 5
@Jatin, we have solved this issue using the Canvas SDK Publisher JS API here: http://www.salesforce.com/us/developer/docs/case_feed_dev/Content/case_feed_dev_guide_component_interactions.htm

I have a Custom Console Component that calls this function to send a message to the Publisher Action.
Sfdc.canvas.publisher.publish({name: "publisher.customActionMessage", payload: {actionName: "MyNamespace__My_Custom_Action", message: "My Custom Message"}});

And the VF page for my Publisher Action has this:
<script>
$(function(){
	Sfdc.canvas.publisher.subscribe([{name : "publisher.customActionMessage", onData : function(e) {
		if (e.message === "My Custom Message") {
			//do something
		}
	}}]);
});
</script>

This seems to be working quite well for us so far. Hope it helps.
 
This was selected as the best answer
kush1234kush1234
Hello,

I'm unable to succesfully subscribe to publish.customActionMessage event. I've a custom Knowledge Sidebar and my goal is to send an event to a custom publisher action in the case feed. I tried the basic example by publishing a message with actionName = my VF page name. But it never works. I've tried debugging the problem but couldn't find the right way to do it.


@James Can you please help me out? Or tell me what I may be doing wrong?

Thanks
Mark DeveloperMark Developer

Hi ,

I know this question may not be completely related to this thread. But I see the people working on similar stuff.

Our team is planning to move to new lightning service console(released in spring 17) from the Salesforce console app(classic) (not migrating but building the new application). I am not sure of what would be the consequences that we may face in Lightning service console to Classic.
Also what would happen to the components / visualforce pages / integrationtoolkit methods that  were using the integrationtoolkit when in Salesforce console app classic moved into the Lightning Service Console.