You need to sign in to do that
Don't have an account?
RogerHand
Flex toolkit R3.1: DescribeSObjectResult.fields always empty
I am using Flex toolkit version R3.1 and am never seeing anything in the describeSObjectResult.fields property for either a native or custom object. Other properties show up fine but the fields property, while not null, always has a length of 0.
Also, the ObjectUtil.toString() utility function shows the fields.
Code:
Thanks in advance for any help!
private function describeSObjectsSample():void { apex.describeSObjects(["Contact", "KAILEA__change__c"], new AsyncResponder(describeSObjects2, genericFault)); } private function describeSObjects2(describeSObjectResults:Array):void { for (var i:int=0; i<describeSObjectResults.length; i++) { describeSObject2(describeSObjectResults[i]); } } private function describeSObject2(describeSObjectResult:DescribeSObjectResult):void { var objectName:String = describeSObjectResult.name; Alert.show("Object name: " + objectName + ", createable: " + describeSObjectResult.createable + ", queryable: " + describeSObjectResult.queryable + ", updateable: " + describeSObjectResult.updateable + ", custom: " + describeSObjectResult.custom ); Alert.show("toString(): " + ObjectUtil.toString(describeSObjectResult)); var fields:Array = describeSObjectResult.fields; Alert.show("describeSObject2() have fields? " + (fields != null)); Alert.show("describeSObject2() fields.length: " + fields.length); for (var f:int=0; f<fields.length; f++) { var field:Field = fields[f]; Alert.show("field: " + field.name); } // next field }
Thanks in advance for any help!
-Roger
Or is it failing with the sample of describeSObjects?
here is the output of describesobjects on my system, fields array appears to be filled in with info:
(some content deleted to allow a post...)
Code:
The output you pasted appears to be from the Macromedia ObjectUtil.toString() function. As I mentioned in my post, this does work to show the fields.
However, the fields are not available by accessing the DescribeSObjectResult.fields property.
I started with the R3.4 salesforce.mxml example and changed the describeSObjects() function to call this new function in it's AsyncResponder:
Code:
The result is always 0.
-Roger
Associative arrays
Associative arrays, which are sometimes called hashes or maps, use keys instead of a numeric index to organize stored values. Each key in an associative array is a unique string that is used to access a stored value. An associative array is an instance of the Object class, which means that each key corresponds to a property name. Associative arrays are unordered collections of key and value pairs. Your code should not expect the keys of an associative array to be in a specific order.
---------
here is how you can traverse the fields array.
Code:
length would be valid for an array that had ary[0], ary[1], ary[2] etc, but not for associative arrays which are indexed by strings
can't explain it, had me confused also.
Message Edited by Ron Hess on 06-06-2007 01:51 PM
Thanks! That did it!
ECMAscript seems to be even weirder than I thought ... !
-Roger
Hi,
I am trying for the same solutions can you give me the code I am just getting any describeSObjects_CB Result\n.
I am not getting any fields in that. Please help me out its very urgent