{"id":2230,"date":"2010-04-21T13:31:34","date_gmt":"2010-04-21T08:31:34","guid":{"rendered":"http:\/\/www.chiragmehta.info\/chirag\/?p=2230"},"modified":"2010-04-21T13:36:03","modified_gmt":"2010-04-21T08:36:03","slug":"salesforce-restrict-emails-on-new-case-task-password-reset","status":"publish","type":"post","link":"https:\/\/www.chiragmehta.info\/chirag\/2010\/04\/21\/salesforce-restrict-emails-on-new-case-task-password-reset\/","title":{"rendered":"Salesforce &#8211; Restrict emails on new case, task, password reset &#8230;"},"content":{"rendered":"<p>The Salesforce.com user interface allows you to specify whether or not to send an email when the following events occur:<\/p>\n<blockquote><p>Creation of a new case or task<br \/>\nCreation of a case comment<br \/>\nConversion of a case email to a contact<br \/>\nNew user email notification<br \/>\nPassword reset<\/p><\/blockquote>\n<p>In Apex scripts saved against API version 15.0 or later, the <strong>Database.DMLOptions emailHeader<\/strong> method enables you to specify additional information regarding the email that gets sent when one of the events occurs because of the script&#8217;s execution.<\/p>\n<p>The following are the options that can be set with the emailHeader method:<\/p>\n<ol>\n<li><strong>triggerAutoResponseEmail <\/strong>: Indicates whether to trigger auto-response rules (true) or not (false), for leads and cases. In the Salesforce.com user interface, this email can be automatically triggered by a number of events, for example creating a case or resetting a user password. If this value is set to true, when a case is created, if there is an email address for the contact specified in ContactID, the email is sent to that address. If not, the email is sent to the address specified in SuppliedEmail.<\/li>\n<li><strong>triggerOtherEmail <\/strong>: Indicates whether to trigger email outside the organization (true) or not (false). In the Salesforce.com user interface, this email can be automatically triggered by creating, editing,or deleting a contact for a case.<\/li>\n<li><strong>triggerUserEmail <\/strong>: Indicates whether to trigger email that is sent to users in the  organization (true) or not (false). In the Salesforce.com user interface, this email can be automatically triggered by a number of events; resetting a password, creating a new user, adding comments to a case, or creating or modifying a task.<\/li>\n<\/ol>\n<p>In the following example, the triggerAutoResponseEmail option is specified:<\/p>\n<blockquote><p>Account a = new Account(name=&#8217;Acme Plumbing&#8217;);<br \/>\ninsert a;<br \/>\nContact c = new Contact(email=&#8217;jplumber@salesforce.com&#8217;, firstname=&#8217;Joe&#8217;,lastname=&#8217;Plumber&#8217;,accountid=a.id);<br \/>\ninsert c;<br \/>\n<strong>Database.DMLOptions dlo = new Database.DMLOptions();<br \/>\ndlo.EmailHeader.triggerAutoResponseEmail = true;<br \/>\n<\/strong>Case ca = new Case(subject=&#8217;Plumbing Problems&#8217;, contactid=c.id);<br \/>\ndatabase.insert(ca, dlo);<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The Salesforce.com user interface allows you to specify whether or not to send an email when the following events occur: Creation of a new case or task Creation of a case comment Conversion of a case email to a contact New user email notification Password reset In Apex scripts saved against API version 15.0 or [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[169],"class_list":["post-2230","post","type-post","status-publish","format-standard","hentry","category-salesforce","tag-salesforce","post-preview"],"_links":{"self":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/comments?post=2230"}],"version-history":[{"count":4,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2230\/revisions"}],"predecessor-version":[{"id":2234,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2230\/revisions\/2234"}],"wp:attachment":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/media?parent=2230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/categories?post=2230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/tags?post=2230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}