I have recently enabled omnichannel in our org. I need to perform some action when an agent accepts a post from the omnichannel widget in the console. To do this I added a hidden custom console component in the console with the below code

<script id="clientEventHandlersJS" language="javascript">
    var eventHandler = function (result) {
    alert('I m in');

</script> </apex:page>

But I am getting error for this page:

Uncaught SyntaxError: Invalid or unexpected token

And another error:

unrecognized Content-Security-Policy directive 'reflected-xss'. Failed to load resource: the server responded with a status of 404 (Not Found)

Can anyone let me know why these issues are happening? Thanks in Advance!

  • Correct me if I'm wrong, I think function eventHandler() should be called something like this-- sforce.console.ConsoleEvent.​PRESENCE.WORK_ACCEPTED(eventHandler()); – Rohit Mourya Apr 5 '17 at 7:06
<apex:page showHeader="false" sidebar="false" standardStylesheets="false" applyHtmlTag="true" applyBodyTag="true" docType="html-5.0">
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

    <apex:includeScript value="/support/console/40.0/integration.js"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery_ui, 'js/jquery-1.6.2.min.js')}" />



            function (result) {
                console.log('Accepted work item: ', result);
  • Try this code and let me know if this works for you. – Sharath Reddy Mar 27 '18 at 15:59
  • 5
    please explain "how and why" your code should work, code dumps are not really useful without an explanation. – glls Mar 27 '18 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.