You need to sign in to do that
Don't have an account?
DaveGraupner
Undefined search results in S-control
HI,
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 = sforce.connection.search(sstr);
alert(sr.className);
alert(sr.length);
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?
Thanks
Dave
Hardhat
Well, for one, you seem to have an extra parenthesis in that query. Have you tried it in Force.com Explorer to see that it works there?
DaveGraupner
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?
Thanks
werewolf
I don't know about the AJAX tools, I don't really use it very much. In Force.com 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.