DescribeSObjectResult.fields always empty

Help
Roger Hand
2007-05-31
2013-04-17
  • Roger Hand
    Roger Hand
    2007-05-31

    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.

    Here's the code:
    -------------------
    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
    }

    -------------

    This was also posted on the Ajax toolkit discussion board at the Salesforce Developer Network:
    http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=2690

    Thanks in advance for any help!