[SalesForce] Unable to open primarytab Console Toolkit Integration

I was trying to follow the first example which is given in the official documentation . I did almost exactly like its there in documentation ( apart from changing the version of integration.js from 20 to 28. Although it didn't work for 20 also ).

When i click on the links browser doesn't respond but following is the errror which i am getting in the chrome console.

Uncaught ReferenceError: openPrimaryTab is not defined

Unsafe JavaScript attempt to access frame with URL https://ap1.salesforce.com/ui/support/servicedesk/ServiceDeskPage?tsid=XXXXX from frame with URL https://c.ap1.visual.force.com/apex/consoleToolKitSample?id=XXXXXX&isdtp=vw&nonce=XXXXX&sfdcIFrameOrigin=https%3A%2F%2Fap1.salesforce.com&=undefined#. Domains, protocols and ports must match

Error

P.S. : I have added the domains which i am accessing in the page in whitelisted domains.
Also Integration.js is getting loading properly

Update : As mentioned above almost exactly means apart from changing the version no from 20 to 28 rest everything is same

I have given the reference to the document, so thought of no point in posting code which would be redundant ( nevertheless please find the link http://www.salesforce.com/us/developer/docs/api_console/api_console.pdf which i am referring to and also code is in page no 5 with a small change
i.e. using version 28.0 instead of 20.0…Although using version 20.0 didn't work.

Best Answer

The documentation is see here: www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_openprimarytab.htm shows the call being made to

sforce.console.openPrimaryTab(null, 'http://www.salesforce.com', false, 
            'salesforce', openSuccess, 'salesforceTab');

not having your code to go on, i going to offer some advice and some shots in the dark.

  1. When asking for help with code, always link to or provide the code.
  2. Always provide more code than you think you need to.
  3. You may not be making the call on the sforce.console object. You can test this by loading the page, opening the javascript console, and typing sforce.console.openPrimaryTab(); and hitting enter. you'll most likely get an error, but if it's a different error than the one you're experiencing, you'll now know how to properly call the method.

Hit us with some code for more help

Related Topic