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
MohanaGopalMohanaGopal 

Merge Fields in Flex Query

In my S-Control I am using follwing query for find who is logged in
      
var query=sforce.connection.query("Select User_ID__c,gos__c,Name from CO_page__c where User_ID__c='{!$User.Username}'");
Like that how can i used in flex coding
 

apex.query("select Name,gos__c,User_ID__c from CO_page__c where User_ID__c='{!$User.Username}'",

When i use this S-Control code I have following message and blank output..
    
TypeError: Error #1009: Cannot access a property or method of a null object reference.
 at <anonymous>()[C:\Documents and Settings\Administrator\My Documents\Flex Builder 3\Test\src\Test.mxml:28]
 at com.salesforce::AsyncResponder/result()[/home/jamesw/projects/mavericks/sdk/src/com/salesforce/AsyncResponder.as:90]
 at SalesForceResponder/result()[/home/jamesw/projects/mavericks/sdk/src/com/salesforce/Connection.as:1303]
 at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:197]
 at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:159]
 at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:165]
 at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:191]
 at mx.rpc::Responder/result()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:41]
 at mx.rpc::AsyncRequest/acknowledge()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
 at DirectHTTPMessageResponder/completeHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:381]
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at flash.net::URLLoader/onComplete()
 
How can i avoid it..
werewolfwerewolf
You'd have to pass in those values as parameters to the flex component when the page loads.  Merge fields will only work in HTML and Javascript, not a compiled language like Flex.
MohanaGopalMohanaGopal

Thanks for ur reply...

    I am using one list button in my Custom Object Detail page. In my custom object i have look up for Account and Contact...

When I click the button I have called flex .swf file using S-Control... In that flex I have to display Account and Contact Name in outout page, How is it possible..

How can I pass this fields values to flex when I click the button ..

       From this value I need to query and retrived some values and display in flex..

Send some sample code for me..