function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bz880bz880 

Possible AJAX toolkit bug?

I'm looking at the DescribeSObject call and it's relation to the Ajax toolkit. In my use case, I want to use the DescribeSObject to see if the Opportunity is createable. When I use the Ajax toolkit and call DescribeSObject, the response xml contains an element as such.

true.

However, when I access this field from javascript, as such
var objDesc = sforceClient.DescribeSObject("Opportunity");
alert(objDesc.createable)
it will always return false.

To further validate my point, when I use the SForce Explorer and describe Opportunity, the createable will always equal false for the Opportunity Object.

Has anyone seen anything like this before? Is there a workaround?

Thanks
Baldwin
bz880bz880
Further clarification:

The response XML contains.

<createable>true</createable>

I forgot to escape the html in the message above.
SteveBowerSteveBower
Quickly looking around, I think there is a typo in sforceclient.js which is causing this.
I have the same behavior, but I can still create Opportunity objects.

The line:

2245 this.createable = Sforce.DOM.GetBool(Sforce.DOM.GetElementValue (soap, "creatable"));

Seems to have a typo: "createable".

I think that might do the trick?

Steve.
DevAngelDevAngel
Right, booleans need special treatment. I believe we have fixed it in the dynabean implementation, but I'll need to take a look at the DescribeSObject result as well.

Thanks for the excellent info.