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
BeetFarmerBeetFarmer 

Case auto-response rules not firing when created through API

I'm creating cases through the api.  We have an auto-response rule that we would like to fire, but it's not throwing any email.  I look in the debug log and it says the rule evaluated to true. 
 
Rule entry order: 2
[Case : Functional Area equals Website Change Request]
AND [Case : Case Origin equals Website]
Value found: 14
Value found: Website
Criteria evaluates to true
Spooling All Immediate Actions
[Case: 20285 50060000004GMZ5]
  Response notify: Bill Brasky, Email: sxxxxxx@xxxxxxxxxxxxxx.com
  Template: 00X60000000wKv8
Nothing is going out.   Any thoughts??
 
werewolfwerewolf
Try turning on the EmailHeader for autoresponse rules when you make that api call:

http://www.salesforce.com//us/developer/docs/api/Content/sforce_api_header_emailheader.htm#kanchor427
kjpetersonkjpeterson
I am creating a case with the EmailHeader property set but I am still not getting the auto response email.  Can you think of anything else that could be affecting this?
 
Code:
  Public Function CreateCase(ByVal oSalesforceCase As [Case]) As String
    Dim oSaveResults() As SaveResult = Nothing
    CreateCase = String.Empty

    Dim oAssignmentRuleHeader As New AssignmentRuleHeader
    oAssignmentRuleHeader.useDefaultRule = True

    Dim oEmailHeader As New EmailHeader
    oEmailHeader.triggerAutoResponseEmail = True

    oBinding.AssignmentRuleHeaderValue = oAssignmentRuleHeader
    oBinding.EmailHeaderValue = oEmailHeader

    oSaveResults = oBinding.create(New sObject() {oSalesforceCase})
    If oSaveResults(0).success = True Then
      CreateCase = oSaveResults(0).id
    End If
  End Function

 
mckinnmdmckinnmd

Any updates on this one? I'm having the same issue...

 

Previously worked via Web2Lead, now trying to use API. Used the "triggerAutoResponseEmail" in the emailheader settings, but it's not firing the email off....

 

Any help would be greatly appreciated! 

Kirk F.ax361Kirk F.ax361

I think this has been posted elsewhere, but to resolve this thread...
Code similar to this works for me:

     case ca = new case();
//set your case fields here, etc.

//these are the lines you need to trigger assignment rules, or auto-response messages:
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
dmo.EmailHeader.triggerAutoResponseEmail = true;
ca.setOptions(dmo);

//now that the options are set,
//the insert call triggers the assignment rules and auto-response email
insert ca;