Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

E-mail activities are not automatically sent to the recipients when you distribute e-mail activities for a campaign in Microsoft Dynamics CRM


View products that this article applies to.

Symptoms

When you distribute e-mail activities for a campaign in Microsoft Dynamics CRM, the e-mail activities are not automatically sent to the recipients. Instead, you have to open each e-mail activity. Then, you have to send each e-mail activity manually.

↑ Back to the top


Resolution

This problem is fixed in Microsoft Dynamics CRM 3.0 Update Rollup 1. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
922815 Update Rollup 1 for Microsoft Dynamics CRM 3.0 is available
This problem is fixed in Update Rollup 1 for Microsoft Dynamics CRM 3.0 Professional Edition for Service Providers. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
935731 Update Rollup 1 for Microsoft Dynamics CRM 3.0 Professional Edition for Service Providers is available

Installation information

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows


After you install this update rollup, create a registry entry on the Microsoft Dynamics CRM server that is named CampaignSendEmail. To do this, follow these steps:
  1. Click Start, click Run, type regedit, and then click OK.
  2. In Registry Editor, locate the following registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\MSCRM
  3. Create the registry entry. To do this, follow these steps:
    1. Right-click MSCRM, point to New, and then click DWORD Value.
    2. In the Name field, type CampaignSendEmail.
    3. Double-click this registry entry, and then type 1 in the Value field.

      Note If you type 1 in the Value field, CRM will automatically send e-mail activities for a campaign. If you type 0 in the Value field, CRM will not automatically send e-mail created from the campaign

↑ Back to the top


Workaround

To work around this problem instead of installing this hotfix, create a Workflow .NET assembly to send e-mail activities automatically.

Note Microsoft CRM 3.0 does not support any .NET assemblies for which the following conditions are true:
  • You created the .NET assembly by using Microsoft Visual Studio .NET 2005 and the .NET Framework version 2.0.
  • You intend to use the .NET assembly as a Callout assembly or as a Workflow assembly.
To create a Workflow .NET assembly, follow these steps:
  1. Create a new bit-type field on the Microsoft CRM E-mail form to specify that the e-mail activity is for a campaign:
    1. In Microsoft CRM, click GoTo, point to Settings, click Customization, click Customize Entities, click E-mail, click More Actions, and then click Edit.
    2. Click Attributes, and then click New.
    3. In the Display Name field, type a name. This example uses the name "Campaign E-mail."
    4. In the Type list, click bit.
    5. In the Default Value list, click No, and then click Save and Close.
    6. Click Forms and Views.
    7. Click Form, click More Actions, and then click Edit.
    8. Click Add Fields, click the new field that you created, click OK, and then click Save and Close.
    9. In the E-mail Entity window, click Actions, click Publish, and then click Save and Close.
  2. Create a .NET assembly to send the e-mail activities. The following steps create a new class library that is named AutoSend by using Microsoft Visual Studio .NET 2003:
    1. Start Visual Studio .NET 2003, and then click New Project.
    2. Click Visual C# Projects, click Class Library, type AutoSend for the name, and then click OK.
    3. In Solution Explorer, right-click References, and then click Add Web Reference.
    4. In the URL field, type the path of the Crmservice.asmx file. In the following example, localhost:5555 is a placeholder for the name of the Microsoft CRM Web site:
      http://localhost:5555/mscrmservices/2006/crmservice.asmx
    5. Change the value in the Web reference name field to CrmSdk.
    6. Click Add Reference.
    7. Add the following using statement.
       using AutoSend.CrmSdk; 
    8. Create a public method that accepts a Guid parameter for the ActivityId field of the e-mail.

      Note You must replace the GUID value that is specified in the service.CallerIdValue.CallerGuid line with the GUID value in the SystemUserId field of a user from the Microsoft CRM system who has the appropriate permissions to send e-mail activities.

      You can use the Fetch method to retrieve this user. Your method will resemble the following.
       
      public void SendEmail(Guid campaignActivityID)
      		{
      			CrmService service = new CrmService();
      			service.Credentials = System.Net.CredentialCache.DefaultCredentials;
      
      			service.CallerIdValue = new CallerId();
      			// Replace the GUID with the GUID of 
         the Microsoft CRM Administrator.
      			service.CallerIdValue.CallerGuid = new 
         Guid("FD80F8E8-C852-DA11-B1FB-0007E94D105B");
      
      			SendEmailRequest req = new SendEmailRequest();
      			req.EmailId = campaignActivityID;
      			req.TrackingToken = "";                                                                   
      			req.IssueSend = true;      
      
      			try 
      			{
      				SendEmailResponse res = (SendEmailResponse)service.Execute(req);
      			}
      			catch (System.Web.Services.Protocols.SoapException er)
      			{
      				// Process any error messages here.
      			}
      
      		} 
    9. After you change the service.CallerIdValue.CallerGuid line, click Build, and then click Build Solution.
    10. Copy the newly created AutoSend.dll file that is in the Bin\Debug folder of your solution to the following folder:
      Program Files\Microsoft CRM\Server\Bin\Assembly
  3. Add the assembly information to the Workflow.config file:
    1. Click Start, point to Programs, point to Administrative Tools, and then click Services.
    2. In the Services window, right-click Microsoft CRM Workflow Service, and then click Stop.
    3. Locate the Workflow.config file, and then open this file in Notepad. By default, the path is as follows:
      C:\Program Files\Microsoft CRM\Server\Bin\Assembly\Workflow.config
    4. In the methods node, paste the following information.
       
      <method name="E-mail"
      		assembly="AutoSend.dll"
      		typename="AutoSend.Class1"
      		methodname="SendEmail">
      		<parameter name="E-mailId" datatype="lookup" 
      entityname="email"/>
      </method> 
      
    5. Change the first line of Workflow.config file to the following.
       
      <workflow.config xmlns="http://microsoft.com/mscrm/workflow/" 
      allowunsignedassemblies="true"> 
      
    6. Save the file, and then close it.
    7. In the Services window, right-click Microsoft CRM Workflow Service, and then click Start.

      Note If the Services window is not open, repeat step 3a.
  4. Create a workflow rule that calls the Microsoft .NET assembly to send the e-mail activities:
    1. On the Microsoft CRM Web server, click Start, point to Programs, point to Microsoft CRM, and then click Workflow Manager.
    2. In the Entity Type list, click E-mail, and then click New.
    3. In the Name field, type Send Campaign E-mail. In the Event box, leave Create selected, and then click Next.
    4. Click Insert Condition, and then click Check conditions.
    5. Click add conditions here, click Insert Condition, and then click Check entity condition.
    6. In the Field list, click Campaign E-mail, click the equal sign, and then click the lookup button.
    7. In the Static Value list, click Yes, and then click OK two times.
    8. Click Insert Condition, and then click Check entity condition.
    9. In the Field list, click Direction, click the equal sign, and then click the lookup button.
    10. In the Static Value list, click Outgoing, and then click OK two times.
    11. Click add actions here, click Insert Action, point to Call assembly, and then click E-mail.
    12. In the Action Name box, type Send Campaign E-mail.
    13. Double-click the E-mailId parameter, click Dynamic Value, leave E-mail selected in the Entity box, and then click OK two times.
    14. Click Save.
    15. Right-click the newly created rule, and then click Activate.
  5. Test the rule. To do this, create a new campaign e-mail activity, and then set the Campaign E-mail field to Yes:
    1. In Microsoft CRM, select a test account record, click Create Quick Campaign, and then click For Selected Records.
    2. Click Next, and then type Test Quick Campaign in the Name text box.
    3. Click Next, click E-mail, and then click Next.
    4. In the Subject box, type Test E-mail, and then type Test in the body of the e-mail.
    5. In the Campaign E-mail field, click Yes, and then click Next.
    6. Click Create, and then verify that the e-mail activity has been sent.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was corrected in Microsoft Dynamics CRM 3.0 Update Rollup 1 and in Update Rollup 1 for Microsoft Dynamics CRM 3.0 Professional Edition for Service Providers.

↑ Back to the top


References

824684 Description of the standard terminology that is used to describe Microsoft software updates
887283 Microsoft Business Solutions CRM software hotfix and update package naming standards

↑ Back to the top


Keywords: KB911520, kbmbsmigrate, kbmbsworkflow, kbqfe, kbmbsemail

↑ Back to the top

Article Info
Article ID : 911520
Revision : 9
Created on : 10/9/2011
Published on : 10/9/2011
Exists online : False
Views : 354