{"id":3392,"date":"2013-07-08T09:25:56","date_gmt":"2013-07-08T03:55:56","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=3392"},"modified":"2013-07-08T09:25:56","modified_gmt":"2013-07-08T03:55:56","slug":"troubleshooting-email-to-case","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/troubleshooting-email-to-case\/","title":{"rendered":"Troubleshooting Email to Case"},"content":{"rendered":"<p style=\"text-align: justify;\">In Previous article, I have explained that <a title=\"Email to Case Agent in Salesforce\" href=\"https:\/\/jitendrazaa.com\/blog\/salesforce\/working-with-email-to-case-agent-in-salesforce\/\">how to configure Email to Case Agent for creating of cases in Salesforce<\/a>. This article depicts how to troubleshoot few common problems of Email to case or On Demand Email to Case.<\/p>\n<p style=\"text-align: justify;\"><strong>Q 1 : Why reply to email is also becoming new Case instead of Comment on existing Case?<\/strong><br \/>\n<strong> Ans :<\/strong> We need to include <strong>{!Case.Thread_Id}<\/strong> field in Subject line or body then only it will be added in &#8220;Open Activity&#8221;\u009d Section.<\/p>\n<p style=\"text-align: justify;\">Also, Go to <strong>&#8220;Setup | App Setup | Customize | Cases | Email-to-Case &#8220;<\/strong>. There is a section on the Email-to-Case Settings page that says: &#8220;When sending email from a case, insert Thread ID in the following sections:&#8221; make sure that there is a check for Subject and Body. This will place a ThreadID on the email being sent from the Case. The ThreadID is a reference number that gets checked when coming back into Salesforce and will route itself to the right Case instead of creating a new one.<!--more--><\/p>\n<hr \/>\n<p><strong>Q 2 : I want reply added as Comment but not as Activity in Email to case. How to do this?<\/strong><br \/>\n<strong> Ans :<\/strong><br \/>\nA workflow rule + an apex trigger would work.<\/p>\n<ul>\n<li>Make a custom field on Case called &#8220;last email.&#8221; Don&#8217;t show it on any page layout.<\/li>\n<li>Make a workflow rule on Email Message which copies the text of the email to that field.<\/li>\n<li>Make an Apex trigger on Case which takes that field and makes a new comment out of it.<\/li>\n<\/ul>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\ntrigger commentMove on Case (after update) {\n  Case myCase = trigger.new&#x5B;0];\n  if (myCase.Last_email__c!= null) {\n    String caseId= myCase.ID;\n    CaseComment cc = new CaseComment(CommentBody=myCase.Last_email__c,parentID=caseId);\n    insert cc;\n  }\n}\n<\/pre>\n<hr \/>\n<p><strong>Q 3 : I want to break Auto Reply (Out of Office Message, On Leave Message) to Auto Response for Email to case. How to achieve this?<\/strong><br \/>\n<strong> Ans :<\/strong> There is exactly no full proof solution to this problem but we can try to check if reply is coming on Same day (We can also check if reply is coming in 5 minutes or 10 minutes). Below Trigger will help to break this loop if there are atleast 4 emails and last email was less than 5 minutes:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\ntrigger LoopKiller on Case (before insert) {\n  \/*\n  * Email Loop Killer\n  * Will not process new email if there are atleast 4 emails from\n  * the same email with the same subject and the previous email was less than 5 minutes ago\n  *\/\n  case&#x5B;] c = trigger.new;\n\n  case&#x5B;] check = &#x5B;select ID, CreatedDate, subject from Case where SuppliedEmail = :c&#x5B;0].SuppliedEmail and subject = :c&#x5B;0].subject and isclosed = false order by CreatedDate desc];\n  system.debug(c&#x5B;0].SuppliedEmail);\n  system.debug(c&#x5B;0].subject);\n\n  if(c&#x5B;0].Subject != null) {\n    \/\/We have a subject, proceed.\n    if(c&#x5B;0].subject.contains('&#x5B; ref:')){\n      \/\/No Errors.  Email should be attached to the case.\n    }else{\n      if(check.size() &gt; 3){\n        if((check&#x5B;0].createddate.addMinutes(5) &gt; System.now()) &amp;&amp; check&#x5B;0].subject.contains(c&#x5B;0].subject)){\n          c&#x5B;0].addError('Automatic email loop has been terminated');\n          \/\/Loop Was Killed.\n        }else{\n          \/\/New Case should be created now!\n               }\n      }\n    }\n  }\n}\n<\/pre>\n<p><strong>Youtube Video Tutorial of Email to Case Agent:<\/strong><\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"\/\/www.youtube.com\/embed\/rbk35_TnQ0Y\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Previous article, I have explained that how to configure Email to Case Agent for creating of cases in Salesforce. This article depicts how to troubleshoot few common problems of Email to case or On Demand Email to Case. Q 1 : Why reply to email is also becoming new Case instead of Comment on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[9],"tags":[90,149],"class_list":["post-3392","post","type-post","status-publish","format-standard","hentry","category-salesforce","tag-email-to-case","tag-on-demand-email-to-case"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1279,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/create-and-manage-assignment-rules-in-salesforce\/","url_meta":{"origin":3392,"position":0},"title":"Create and manage Assignment rules in Salesforce","author":"Jitendra","date":"October 12, 2010","format":false,"excerpt":"What is assignment rule in salesforce.com, how to create and manage assignment rules in SFDC","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Rule Entry for the Case Assignment in Salesforce","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/10\/Rule-Entry-for-the-Case-Assignment-in-Salesforce.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1241,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/step-by-step-salesforce-tutorial-creating-trigger-and-test-cases-6-of-6\/","url_meta":{"origin":3392,"position":1},"title":"Step by Step Salesforce Tutorial \u2013 Creating Trigger and Test cases \u2013 6 of 6","author":"Jitendra","date":"October 11, 2010","format":false,"excerpt":"Step by Step Salesforce Tutorial \u2013 Creating Trigger and test cases \u2013 6 of 6 tutorials series","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Creating Trigger in Salesforce using force.com IDE","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/10\/Creating-Trigger-in-Salesforce-using-force.com-IDE.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":6528,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/why-quick-actions-are-not-appearing-on-case-page-layout-in-lightning-experience\/","url_meta":{"origin":3392,"position":2},"title":"Why Quick Actions are not appearing on Case page layout in Lightning Experience","author":"Jitendra","date":"July 3, 2018","format":false,"excerpt":"Solution to make quick actions visible on Case & Work Order Page Layouts in Lightning Experience","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Add Quick Actions on Page Layout - Salesforce","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/07\/Add-Quick-Actions-on-Page-Layout-Salesforce.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/07\/Add-Quick-Actions-on-Page-Layout-Salesforce.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/07\/Add-Quick-Actions-on-Page-Layout-Salesforce.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/07\/Add-Quick-Actions-on-Page-Layout-Salesforce.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5487,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/guide-to-setup-omni-channel-in-salesforce-with-video\/","url_meta":{"origin":3392,"position":3},"title":"Guide to setup Omni Channel in Salesforce with Video","author":"Jitendra","date":"May 12, 2016","format":false,"excerpt":"Step by step guide to know about Omni Channel and how does it makes Call Centre Queue Manager's life easier in Salesforce Service Cloud","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Omni Channel - Presence Configurations","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/05\/Omni-Channel-Presence-Configurations.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/05\/Omni-Channel-Presence-Configurations.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/05\/Omni-Channel-Presence-Configurations.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/05\/Omni-Channel-Presence-Configurations.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":6538,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/send-salesforce-survey-without-writing-code\/","url_meta":{"origin":3392,"position":4},"title":"Send Salesforce Survey Without Code","author":"Jitendra","date":"October 21, 2018","format":false,"excerpt":"Use Flow & Process builder to send customer satisfaction survey on case close","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Send Salesforce Survey using Flow and Process Builder","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/10\/Send-Salesforce-Survey-using-Flow-and-Process-Builder.png?fit=1120%2C540&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/10\/Send-Salesforce-Survey-using-Flow-and-Process-Builder.png?fit=1120%2C540&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/10\/Send-Salesforce-Survey-using-Flow-and-Process-Builder.png?fit=1120%2C540&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/10\/Send-Salesforce-Survey-using-Flow-and-Process-Builder.png?fit=1120%2C540&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/10\/Send-Salesforce-Survey-using-Flow-and-Process-Builder.png?fit=1120%2C540&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3830,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/step-by-step-guide-to-setup-federated-authentication-saml-based-sso-in-salesforce\/","url_meta":{"origin":3392,"position":5},"title":"Step by step guide to Setup Federated Authentication (SAML) based SSO in Salesforce &#8211; Video Tutorial","author":"Jitendra","date":"April 14, 2014","format":false,"excerpt":"In this post, We will be dicussing how to setup\u00a0Federated SAML based Authentication in Salesforce. SAML stands for \"Security Assertion Markup Language\" and it is Open standard for exchanging Authentication and Authorization between Systems. SAML based authentication is supported by all editions of Salesforce. User Validation can be initiated by\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Login using SAML Response from AXIOM","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/04\/Login-using-SAML-Response-from-AXIOM.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/04\/Login-using-SAML-Response-from-AXIOM.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/04\/Login-using-SAML-Response-from-AXIOM.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/04\/Login-using-SAML-Response-from-AXIOM.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/3392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=3392"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/3392\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=3392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=3392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=3392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}