+ Start a Discussion
SushiSushi 

using DescribeTab Ajax Toolkit Beta 3.3

Hi

with beta 1 this was working fine when i changed to beta 3.3 i am stuck.

function describeTabs()
{

var dts = sforceClient.DescribeTabs();

for(var i=0;i{
var dts2 = dts[i].tabs;
alert(dts[i].label + " has following tabs");
for (var j = 0;j {
alert(dts2[j].label);
}
}
}
DevAngelDevAngel

Hi Sushi,

This is a bug in the 3.3 toolkit. Thanks for posting this.

You can work around this bug by overriding the field definition for the DescribeTab object's label and sobjectName fields. These are currently defined as boolean (obvious error here) and should be string.

To do this, create a simple function that is called once when the page loads. The best place to call this function from is the function that is called for the body onload event. The function basically re-defines the data type of the two fields mentioned above so that when the soap message is deserialized, the correct type casting will be used.

The new function is shown below.

 function overridePrototypes() { Sforce.DescribeTab.prototype.label = new String(); Sforce.DescribeTab.prototype.sobjectName = new String(); }

So if you have an initPage function or something similar, insert the call to the overridePrototypes function as the first line

 function initPage() { overridePrototypes(); sforceClient.registerInitCallback(describeTabs); sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}"); }

This bug will be addressed in the next maintenance release sometime in the next 2 or 3 days. Leaving the workaround in will not affect your scontrol after the bug fix has been released. Full scontrol is shown below

<html> <head> <title>The Princess Project : volunteer sign-up</title> <meta http-equiv="index.htmlContent-Type" content="text/html; charset=iso-8859-1"> <script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true" type="text/javascript"></scr + ipt> <script> function initPage() { overridePrototypes(); sforceClient.registerInitCallback(describeTabs); sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", false); } function overridePrototypes() { Sforce.DescribeTab.prototype.label = new String(); Sforce.DescribeTab.prototype.sobjectName = new String(); } function describeTabs() { var dts = sforceClient.DescribeTabs(); for(var i=0;i<dts.length;i++) { var dts2 = dts[i].tabs; alert(dts[i].label + " has following tabs"); for (var j = 0;j<dts2.length;j++) { alert(dts2[j]); } } } </script> </head> </html>

 

 

Message Edited by DevAngel on 02-26-2006 01:13 PM