You need to sign in to do that
Don't have an account?
Karl
Invalid field Email for SObject Name
In an Apex script, I do the following:
____________________
Case myCase = [Select
Id,
Owner.FirstName,
Owner.LastName,
Owner.Alias,
Owner.Email
From Case
where id = :id];
// the id field in the SOQL where clause is passed into the method
string ownerEmail = myCase.Owner.Email;
_________
The last line generates the error "Invalid field Email for SObject Name" when trying to compile. When I try this query in the Sforce Explorer, It shows the relationship as "Name" for Case and Task and you can drill down and see the appropriate results. But other objects show the relationship for Owner as "User". I've tried casting to User but that generates an error saying that "Name" is never an instance of "User".
Is this a known issue, and are there any work-arounds?
Message Edited by Karl on 07-07-2008 10:39 AM
____________________
Case myCase = [Select
Id,
Owner.FirstName,
Owner.LastName,
Owner.Alias,
Owner.Email
From Case
where id = :id];
// the id field in the SOQL where clause is passed into the method
string ownerEmail = myCase.Owner.Email;
_________
The last line generates the error "Invalid field Email for SObject Name" when trying to compile. When I try this query in the Sforce Explorer, It shows the relationship as "Name" for Case and Task and you can drill down and see the appropriate results. But other objects show the relationship for Owner as "User". I've tried casting to User but that generates an error saying that "Name" is never an instance of "User".
Is this a known issue, and are there any work-arounds?
Message Edited by Karl on 07-07-2008 10:39 AM
Instead, get the list of OwnerIds for your cases, pull out any ones that are not Users (i.e. don't start with '005'), and do a retrieve call to get all the User objects that correspond to them.