You need to sign in to do that
Don't have an account?
g-man
Search returns empty (null) object
When using the search() method, I get a record back representing my search but the field values are all empty or null. What am I missing here? Here is a code snippet:
SearchResult search = _sforceService.search(
"find {Greg} in NAME fields returning User");
SearchRecord[] records = search.searchRecords;
for (int i = 0; i < records.Length; i++)
{
sObject record = records[i].record;
if (record.GetType() == typeof(User))
{
User u = (User)record;
queryResults.Items.Add("User : " + u.FirstName + " " + u.LastName + " | " + u.Email);
}
}
It returns one User object but all fields are null. Any ideas? I've used the query() method without any problems.
Thanks!
SearchResult search = _sforceService.search(
"find {Greg} in NAME fields returning User");
SearchRecord[] records = search.searchRecords;
for (int i = 0; i < records.Length; i++)
{
sObject record = records[i].record;
if (record.GetType() == typeof(User))
{
User u = (User)record;
queryResults.Items.Add("User : " + u.FirstName + " " + u.LastName + " | " + u.Email);
}
}
It returns one User object but all fields are null. Any ideas? I've used the query() method without any problems.
Thanks!
Superfell
All the fields are null, because your SOSL query didn't include any fields to return.