0

I need help with the query on EmailServicesAddress object Salesforce.

We have setup some Email Service Addresses for Email-To-Case and they have different queues as case owners. I need to query this to run some logic in my code.

I am not getting if we can even query that. its not listed in the documentation Salesforce provided for the EmailServicesAddress.

Link - https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_emailservicesaddress.htm

We can run this query on Email Service Address -

SELECT Id, IsActive, LocalPart, EmailDomainName, AuthorizedSenders, RunAsUserId, FunctionId, Function.FunctionName, DeveloperName, CreatedById, CreatedDate, LastModifiedById, LastModifiedDate, SystemModstamp FROM EmailServicesAddress where Function.FunctionName='EmailToCase'

But it is not having any field to query Case owner field.

  • Try this (SELECT Id, IsActive, LocalPart, EmailDomainName, AuthorizedSenders, RunAsUserId, FunctionId, Function.FunctionName, DeveloperName, CreatedById, CreatedDate, LastModifiedById, LastModifiedDate, SystemModstamp FROM EmailServicesAddress where Function.FunctionName='EmailToCase'). – Vinay Sep 11 at 11:46
  • @Vinay This query is not giving information about the 'Case Owner' field that we setup while creating email service addresses. – Amit Agarwal Sep 11 at 14:17
  • Not finding anything to help myself. I have raised an idea for this.trailblazer.salesforce.com/ideaView?id=0874V000000chJ1QAI – Amit Agarwal Sep 16 at 15:44
0

There isn't any field in EmailServicesAddress that gives the case owner as you have specified. However, note that the case owner that you see is actually a Queue

enter image description here

enter image description here

Searching through REST explorer confirms that case owner(Queue) Metadata is not exposed through EmailServiceAddress sObject as well

enter image description here

I recommend querying for the queue instead

select Id, DeveloperName, Type from Group where  Type = 'Queue' AND NAME = 'SFDC'
| improve this answer | |
  • When we setup email service address in Salesforce there we have a field 'Case Owner' in this we can specify either a queue or a user. I need to query that field, to know which queue is setup as the case owner for which service address. I need to write a business logic accordingly. – Amit Agarwal Sep 11 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.