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

Undefined search results in S-control

I have the following code as part of some javascript in an S-Control. The javascript is using version 12 of the API

function SearchAccounts() {
var sstr = "FIND {ABCDEF} IN NAME FIELDS RETURNING Account((Id, Name, OwnerId)";
var sr =;
return sr.GetArray("searchRecords");

There is an account existing with the name ABCDEF. Both alerts display undefined. I've checked the docs and the syntax is correct. The sforce.connection objects works as I have used it in other calls before this function executes.

What do I need to do to get search to return the results properly?



Well, for one, you seem to have an extra parenthesis in that query.  Have you tried it in Explorer to see that it works there? 
The 2nd bracket shouldn't be there (you can never proof read something too many times!)
I have used the Explorer for regular queries (select ...) but I do not see how to use Explorer for SOSL queries. Could you point me in the direction on to run SOSL queries in Explorer.
If I run: SELECT Name, Id FROM Account where Name ='ABCDEF'  in the Explorer it returns one record as expected. Also if I run this same SELECT as a query from the javascript it works fine. There is something with the SOSL line or call that I must be missing?
BTW I tried to run SOSL (or anything for that matter) in the Ajax Tools Shell but I just get unknown lang back. Any idea on what I have to do to get the shell working?
I don't know about the AJAX tools, I don't really use it very much.  In Explorer (8.0, you should get the latest version if you don't have it), just log in and click on the SOSL Tester tab to do a SOSL query.