6

I am developing a salesforce CTI integration that uses Version 37 of the salesforce JavaScript API.

When the user logs into the softPhone view I open another tab using the sforce.console.openPrimaryTab function. I have had this functionality working for a long time, but this morning it is not opening the tab, and I haven't changed any code relating to it.

I call the openPrimary tab like this:

salesforceApi.console.openPrimaryTab(null, salesforceConfigurationManager.dashboardTabUrl, true, 'Dashboard', myCallback, 'myDashboardTabName');

My callback method is never hit.

I can see an error in the console:

aura_prod.js:878 Uncaught TypeError: Cannot read property 'indexOf' of undefined
throws at https://mysalesforceName.cs26.my.salesforce.com/jslibrary/1493309924000/sfdc/main.js:1290:54 TypeError: Cannot read property 'indexOf' of undefined
at Function.QueryString.getQueryStringIndex (main.js:1290)
at Function.QueryString.getURI (main.js:1290)
at Object.Sfdc.support.servicedesk.isNewEditUrl (ServiceDesk.js:formatted:4256)
at constructor.checkIsLimited (ServiceDesk.js:formatted:13626)
at new constructor (ServiceDesk.js:formatted:13488)
at Object.create (ext.js:formatted:9782)
at constructor.createComponent (ext.js:formatted:11583)
at constructor.lookupComponent (ext.js:formatted:11574)
at constructor.add (ext.js:formatted:11454)
at constructor.replaceTab (ServiceDesk.js:formatted:18607)

When I debug the code I can see that the error is occurring when it is checking if the URL of the tab I want to open is allowed (the checkIsLimited function on serviceDesk.js).

enter image description here

The error is thrown because the contentUrl property of the object that is being passed into the checkIsLimited function is undefined.

If I trace back to the beginning of the error stack (the replaceTab function), I can see that in here the contentUrl property is also undefined.

enter image description here

If I set the contentUrl property by setting a break-point in the JavaScript and manually changing the value, the tab will open, so it looks like this is the cause of the issue, however I don't know what is causing contentUrl to be undefined as I have changed nothing in my code

  • I have tried logging in with a different user to determine if there is some user setting that could be causing this, but the problem persists.
  • I have tried calling the openPrimaryTab with only the required parameters and hard-coded values, the tab still doesn't open.
  • I have reverted back to old versions of the code that are currently working in production, the tab still doesn't open.

Any ideas what else I can do. This was working perfectly on Friday and this morning it doesn't work

EDIT: I have just found that the salesforce version has been upgraded to Summer 2017. Should the API calls still not work?

EDIT: Still waiting for salesforce to fix this, but I have noticed that any URL that has less than 2 characters after the domain seems to work. For example https://<domain>/something will crash, as will https://<domain>/som. However https://<domain>/so will work as will https://<domain>/so/mething

6
  • I don't think this would have any effect, but have you tried the "proper" method of using sforce.console.generateConsoleUrl? I don't know why this would make a difference, but perhaps you could give it a spin?
    – sfdcfox
    Commented May 8, 2017 at 13:36
  • @sfdcfox I have tried using generateConsoleUrl followed by openConsoleUrl and I get the same error.
    – Neil
    Commented May 8, 2017 at 14:30
  • What is the url you are trying to open? I have one that is working and one that isn't. The one that isn't looks like xyz.com/dashboard. It seems that the word dashboard makes it think it is trying to open a Salesforce dashboard. Commented May 8, 2017 at 17:24
  • The url doesn't include the word dashboard, also I tried opening a tab with a very short URL in case it was the issue and got the same result. I believe this is a salesforce issue related to the upgrade. I have also tried using the latest API (version 40) but the same thing happens
    – Neil
    Commented May 8, 2017 at 18:08
  • I traced it down to an issue with the response from /ui/support/servicedesk/servlet/ServiceDeskServlet Looks like in a summer sandbox, the response is a 200, but in spring, it is 500. I guess this means we should open a case with Salesforce... Commented May 8, 2017 at 20:43

1 Answer 1

6

This looks like an issue with Summer 17. I've been able to replicate it in a sandbox. After some "fun" debugging it, here's what I found. There is a call to /ui/support/servicedesk/servlet/ServiceDeskServlet that is done to determine whether or not to build a workspace. It looks like if the URL is a standard URL, it does something different than if it is a custom URL.

In Spring 17, the response from the server is a 500, but in Summer 17, it is a 200. This is causing the Javascript to take different branches.

Spring 17 Spring 17 Response

Summer 17 Summer 17 Response

I'm going to open a case with Salesforce on this and would recommend you do the same.

Edit: Response from support: "I have followed the information you have provided, investigated on the same in your sandbox org. I also recreated and tested in the Spring sandbox. This definitely seems to be release related issue. I have already escalated this issue to my tier 3 team."

Edit 2: A known Issue has been created. I've been told it will be patched in a few days: https://success.salesforce.com/issues_view?id=a1p3A0000008k7xQAA

4
  • I don't suppose you'd mind sharing that case #? I also have the same problem and need to get it resolved. We're not able to do testing in our sandbox because of this.
    – sfdcfox
    Commented May 9, 2017 at 19:30
  • Case number 16450627 Commented May 9, 2017 at 19:31
  • Thanks. By the way, did you happen to have a # in your URL? That seems to be part of the cause.
    – sfdcfox
    Commented May 9, 2017 at 19:32
  • For me, the one that works has a # in the url. The two I was testing with are external servers. Commented May 9, 2017 at 19:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .