Working with a custom button that's part of the Constant Contact managed package. It's a button on the tab list view that collects selected contacts and sends them over to Constant Contact.

The button can be used with standard profiles, but not with the custom profiles we've built. I get an error: "Cannot read property 'length' of null"

My colleague was able to track down the error to this call:

var result = sforce.connection.describeTabs();

Here's the full snippet

var instance;
sforce.connection.sessionId = __sfdcSessionId;
var result = sforce.connection.describeTabs();
for (var i=0; i<result.length; i++) {
var tabSet = result[i].get("tabs");
for(var j=0; j<tabSet.length; j++) {
var tab = tabSet[j];
if(tab.label == "Home")
var url = tab.url.split('.');
var pos = url[0].lastIndexOf('/');
instance = url[0].substring(pos+1);

Any ideas why that would return null (if that is the problem) for custom profiles only?

Thanks in advance!

  • To clarify, "result" is null, not "result.length".
    – sfdcfox
    Sep 29, 2016 at 16:48


You must log in to answer this question.

Browse other questions tagged .