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

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/]
 at SalesForceResponder/result()[/home/jamesw/projects/mavericks/sdk/src/com/salesforce/]
 at mx.rpc::AsyncToken/[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\]
 at mx.rpc::AbstractInvoker/[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\]
 at mx.rpc::AbstractInvoker/[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\]
 at mx.rpc::Responder/result()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\]
 at mx.rpc::AsyncRequest/acknowledge()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\]
 at DirectHTTPMessageResponder/completeHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\channels\]
How can i avoid it..
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.

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..