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
GoForceGoGoForceGo 

Case Thread_Id

I am thinking about using a Email Service to handle inbound e-mails on a case.

The reason is that I have to flip the status of case based upon some subject text in the e-mail.

I will assume that the inbound e-mail have the Thread Id of the case (e.g ref:00D7KKMD.50075Ertx:ref)

How does one match the Thread Id to a case using Apex code.

I can't find the Thread Id field in the case object.

Email Templates does have a field called Case.Thread_Id, but I can't find when I do [select id from case where Thread_Id = ...]





werewolfwerewolf
I wrote this formula field to derive the thread ID:

LEFT( $Organization.Id , 4)
&
IF (MID ( $Organization.Id, 5, 1) <> "0", RIGHT($Organization.Id, 11),
IF (MID ( $Organization.Id, 6, 1) <> "0", RIGHT($Organization.Id, 10),
IF (MID ( $Organization.Id, 7, 1) <> "0", RIGHT($Organization.Id, 9),
IF (MID ( $Organization.Id, 8, 1) <> "0", RIGHT($Organization.Id, 8),
IF (MID ( $Organization.Id, 9, 1) <> "0", RIGHT($Organization.Id, 7),
IF (MID ( $Organization.Id, 10, 1) <> "0", RIGHT($Organization.Id, 6),
IF (MID ( $Organization.Id, 11, 1) <> "0", RIGHT($Organization.Id, 5),
IF (MID ( $Organization.Id, 12, 1) <> "0", RIGHT($Organization.Id, 4),
IF (MID ( $Organization.Id, 13, 1) <> "0", RIGHT($Organization.Id, 3),
IF (MID ( $Organization.Id, 14, 1) <> "0", RIGHT($Organization.Id, 2), "")
)
)
)
)
)
)
)
)
)
& "."
& LEFT( Id, 4)
& IF (MID ( Id, 5, 1) <> "0", RIGHT(Id, 11),
IF (MID ( Id, 6, 1) <> "0", RIGHT(Id, 10),
IF (MID ( Id, 7, 1) <> "0", RIGHT(Id, 9),
IF (MID ( Id, 8, 1) <> "0", RIGHT(Id, 8),
IF (MID ( Id, 9, 1) <> "0", RIGHT(Id, 7),
IF (MID ( Id, 10, 1) <> "0", RIGHT(Id, 6),
IF (MID ( Id, 11, 1) <> "0", RIGHT(Id, 5),
IF (MID ( Id, 12, 1) <> "0", RIGHT(Id, 4),
IF (MID ( Id, 13, 1) <> "0", RIGHT(Id, 3),
IF (MID ( Id, 14, 1) <> "0", RIGHT(Id, 2), "")
)
)
)
)
)
)
)
)
)
werewolfwerewolf
Don't forget that right now (in Winter '09 anyway) you won't be able to run assignment rules from an email service though.
GoForceGoGoForceGo
Thanks.

I won't be able to run case assignment rules if a case is created through Apex Email Services?

When I look at Assignment Rules, they seem pretty generic on how to assign a case...they don't seem to care how the case is created?.



werewolfwerewolf
No, not right now.  When cases are created programatically via the API, you can use an AssignmentRuleHeader to define whether you want assignment rules to be run on them.  There is currently no such option in Apex, and so it just does not run the assignment rules.
GoForceGoGoForceGo
I guess I could just use workflow rules with field update and e-mail alert to change the owner/send out the the notification e-mail....

Seems like that's what assignment rules do - I would not just be able to model the order of rules - as long as they are mutually exclusive, I am okay?







werewolfwerewolf
Yes, as long as they don't conflict you're fine.  If they do conflict, then because workflow runs last, workflow will win.
GoForceGoGoForceGo
Does SFDC provide any monitoring tools for Apex E-mail Services? - e.g what e-mails were received and when and whether Apex e-mail service accepted or rejected.

For mission critical customer support (Case management), one would want to be make sure that e-mails forwarded from support@xxxx.com made it to SFDC and they were processed by SFDC.

The only thing that would provide a debug log would be the "Admin Tools->Monitoring->Debug Log" - would that log the fact that the e-mail was processed by Apex Email Service (not the debug statements I put in the code).







Message Edited by GoForceGo on 10-22-2008 09:19 AM
werewolfwerewolf
Not that I know of, but I believe it's on the roadmap.
ElmilandElmiland

Hi:

 

Anyone seen the Spring'12 Thread ID format change article?

 

Spring '12 Email to Case thread id format change


Knowledge Article Number: 000025321 

Description

With the Spring '12 release the format of the Email to Case thread ID is changing to include additional characters and underscores. Below are the 2 versions for reference.

Spring '12 version    ref:_00DT0EIgQ._500T045kux:ref
Pre Spring '12 version    ref:00DTEIgQ.500T45kux:ref

Note there is a new character added in the first part of the ID shown by the blue 0 and a new character added shown by the blue 0 in the second part of the ID. Underscores are added at the beginning of the ID and after the period in the ID.
This change will not affect existing Email to Case functionality. Organizations who use custom formulas based on  thread IDs or construct their own IDs will need to edit those customizations to recognize the additional characters.
Should this be a new formula?

 

"_"
& LEFT( $Organization.Id , 4)
& "0"
&
IF (MID ( $Organization.Id, 5, 1) <> "0", RIGHT($Organization.Id, 11),
IF (MID ( $Organization.Id, 6, 1) <> "0", RIGHT($Organization.Id, 10),
IF (MID ( $Organization.Id, 7, 1) <> "0", RIGHT($Organization.Id, 9),
IF (MID ( $Organization.Id, 8, 1) <> "0", RIGHT($Organization.Id, 8),
IF (MID ( $Organization.Id, 9, 1) <> "0", RIGHT($Organization.Id, 7),
IF (MID ( $Organization.Id, 10, 1) <> "0", RIGHT($Organization.Id, 6),
IF (MID ( $Organization.Id, 11, 1) <> "0", RIGHT($Organization.Id, 5),
IF (MID ( $Organization.Id, 12, 1) <> "0", RIGHT($Organization.Id, 4),
IF (MID ( $Organization.Id, 13, 1) <> "0", RIGHT($Organization.Id, 3),
IF (MID ( $Organization.Id, 14, 1) <> "0", RIGHT($Organization.Id, 2), "")
)
)
)
)
)
)
)
)
)
& "._"
& LEFT( Id, 4)
& "0"
& IF (MID ( Id, 5, 1) <> "0", RIGHT(Id, 11),
IF (MID ( Id, 6, 1) <> "0", RIGHT(Id, 10),
IF (MID ( Id, 7, 1) <> "0", RIGHT(Id, 9),
IF (MID ( Id, 8, 1) <> "0", RIGHT(Id, 8),
IF (MID ( Id, 9, 1) <> "0", RIGHT(Id, 7),
IF (MID ( Id, 10, 1) <> "0", RIGHT(Id, 6),
IF (MID ( Id, 11, 1) <> "0", RIGHT(Id, 5),
IF (MID ( Id, 12, 1) <> "0", RIGHT(Id, 4),
IF (MID ( Id, 13, 1) <> "0", RIGHT(Id, 3),
IF (MID ( Id, 14, 1) <> "0", RIGHT(Id, 2), "")
)
)
)
)
)
)
)
)
)

 

Any other changes you think are needed? appreciate the input!