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
Amar123Amar123 

SOQL query for getting case owners manager Email Address.

AnkaiahAnkaiah (Salesforce Developers) 
Hi Amar,

try with below soql query.
 
SELECT Id, owner.email FROM case
If this helps, Please mark it as best answer.

Thanks!!
 
mukesh guptamukesh gupta
HI Amar,

Please follow below code:-

First Option:-

A case owner might be a queue, so you cannot use Owner.Manager.Email, but last modified by will always be a user, and hence its allowed to use LastModified.Manager.Email.
List<Case> c = [SELECT Id, CaseNumber, Owner.Email, LastModifiedBy.Manager.Email
FROM Case];

Second Option:-

In the SOQL you can't access the some of the fields via Owner: (Custom fields and some of standard fields)

https://skaruz.com/en/2015/03/salesforce-how-to-access-owner-custom-fields-in-a-soql-query/

so better in the case object create the custom formula field with below formula.

Owner:User.Manager.Email

Then you can easily access the above formula field in soql.

otherwise you have to write the custom code to get the manager email.

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh

 
yumona joeyumona joe

As we are using an Email-to-Case routing address, it will automatically create a case in your org, from where you can verify the ownership of ...innoutsecretmenu.online (https://innoutsecretmenu.online/)
anglina voltan 6anglina voltan 6
The Connecticut-based chain operates over 42431 restaurants in 112 countries worldwide and is looking to grow more. global subway.com