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
bryanobryano 

Help needed with describeGlobal using Flex

So I'm trying to populate a combobox with the results of a describeGlobal call but I keep getting the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.utils::URLUtil$/getProtocol()
    at com.salesforce::Connection/::_invoke()
    at com.salesforce::Connection/::invoke()
    at com.salesforce::Connection/describeGlobal()
    at panea/::describeGlobal()
    at panea/::init()
    at panea/___Application1_applicationComplete()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.managers::SystemManager/::preloader_preloaderDoneHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/::displayClassCompleteHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::DownloadProgressBar/::timerHandler()
    at mx.preloaders::DownloadProgressBar/::initCompleteHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/::dispatchAppEndEvent()
    at mx.preloaders::Preloader/::appCreationCompleteHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.core::UIComponent/set initialized()
    at mx.managers::LayoutManager/::doPhasedInstantiation()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/::callLaterDispatcher2()
    at mx.core::UIComponent/::callLaterDispatcher()


What am I doing wrong?

Here is my code snippet:
Code:
private function describeGlobal():void {
    apex.describeGlobal(new AsyncResponder(describeGCallback, genericFault));
}

private function describeGCallback(result:Object):void {
    var entities:Array = new Array();
   
    for (var i:int=0; i<result.types.list.length; i++) {
        entities.push(result.types.list.source[i]);
    }

    // sfEntities is the id of my combobox
    sfEntities.dataProvider = objectList;                       
}

 

Ron HessRon Hess
this works for me in the salesforce.mxml sample

Code:
   private function describeGCallback(result:Object):void
   {
    ta.text = 'describe Global Result\n' + ObjectUtil.toString(result);
    
     dg.sortableColumns = false;
     dg.columns = [ new DataGridColumn('Types') ];
     dg.dataProvider = result.types;              
    
   }

 

Message Edited by Ron Hess on 08-07-2007 12:02 PM

Ron HessRon Hess
no need to build an array called entities, you get an array back in the callback, look for result.types

also, what is
objectList


I don't see this in your code, but it may be null...
bryanobryano
Thanks for the help Ron.  result.types did it!