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
beener3beener3 

Count() using javascript (for S-control)

Hi,

I'm attempting to create an S-Control which counts something (roll-up fields are not fiesable in my circumstance).

 

I don't know how to use the result in a useful way: the text displayed in the s-control is the followin

 

{done:'true', queryLocator:null, records:null, size:'53', }

 

 I guess I don't know which methods to use to handle the object.

 

 

 

so here's the s-control

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/12.0/connection.js"></script></head><body><SCRIPT LANGUAGE="JavaScript"> var result = sforce.connection.query("select Count() Timesheet__c w "); document.write('result is:'+result);</SCRIPT></body></html>

 

 

 

 

 Any help would be much appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
beener3beener3

yes , but thanks that wasn't the problem.

the solution is accessing result.size. this carries the count() result.

All Answers

werewolfwerewolf
Don't you mean select count() from Timesheet__c?
beener3beener3

yes , but thanks that wasn't the problem.

the solution is accessing result.size. this carries the count() result.

This was selected as the best answer