Skip to main content
Joseph O が「#Customer Service」で投稿

I tried to manually execute the following in Apex Anonymous and the result is returning NULL Case ID. Does anybody know how to use the new case header method?

  #Email #Customer Service #Email-to-case #Case #EmailMessage Object

 

Apex Anonymous 

List<Messaging.InboundEmail.Header> headers = new List<Messaging.InboundEmail.Header>();

Messaging.InboundEmail.Header messageHeader = new Messaging.InboundEmail.Header();

messageHeader.Name = 'Message-ID:';

messageHeader.value = '<BLAPR16MB37478D93BEC69718C9576BEBBF089@BLAPR16MB3747.namprd16.prod.outlook.com>';

headers.add(messageHeader);

Id caseId = Cases.getCaseIdFromEmailHeaders(headers);

System.Debug('JOSEPH DEBUG : caseId ' + caseId);

 

RESULT

 

15:39:52.1 (7718512)|SYSTEM_METHOD_ENTRY|[11]|System.debug(ANY)

15:39:52.1 (7727733)|USER_DEBUG|[11]|DEBUG|JOSEPH DEBUG : caseId null

15:39:52.1 (7735978)|SYSTEM_METHOD_EXIT|[11]|System.debug(ANY)

 

When querying for the record in the EmailMessage for that Message-ID, it exist in the EmailMessage object.

 

SELECT Id, Headers, Subject, MessageIdentifier, ThreadIdentifier, ReplyToEmailMessageId, ParentId, ActivityId, ToAddress, FromAddress

FROM EmailMessage

WHERE MessageIdentifier = '<BLAPR16MB37478D93BEC69718C9576BEBBF089@BLAPR16MB3747.namprd16.prod.outlook.com>'

 

I tried to manually execute the following in Apex Anonymous and the result is returning NULL Case ID. Does anybody know how to use the new case header method? Apex Anonymous List<Messaging.

2 件のコメント
  1. 2022年12月13日 18:49

    Is there a existing emailMessage record (with a parentId pointing to a case) with the message identifier matching your example?

0/9000