Microsoft KB Archive/911520

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

Article ID: 911520

Article Last Modified on 9/19/2007

-

APPLIES TO


 * Microsoft Dynamics CRM 3.0
 * Microsoft Dynamics CRM 3.0 Professional Edition for Service Providers

-



Important This article contains information about how to modify the registry. Make sure that you back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry



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.



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
Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

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:  Click Start, click Run, type regedit, and then click OK. In Registry Editor, locate the following registry subkey:  Create the registry entry. To do this, follow these steps:  Right-click MSCRM, point to New, and then click DWORD Value. In the Name field, type CampaignSendEmail . 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</ol> </li></ol>

<div class="workaround_section">

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: <ol> Create a new bit-type field on the Microsoft CRM E-mail form to specify that the e-mail activity is for a campaign: <ol style="list-style-type: lower-alpha;"> In Microsoft CRM, click GoTo, point to Settings, click Customization, click Customize Entities, click E-mail, click More Actions, and then click Edit.</li> Click Attributes, and then click New.</li> In the Display Name field, type a name. This example uses the name &quot;Campaign E-mail.&quot;</li> In the Type list, click bit.</li> In the Default Value list, click No, and then click Save and Close.</li> Click Forms and Views.</li> Click Form, click More Actions, and then click Edit.</li> Click Add Fields, click the new field that you created, click OK, and then click Save and Close.</li> In the E-mail Entity window, click Actions, click Publish, and then click Save and Close.</li></ol> </li> 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: <ol style="list-style-type: lower-alpha;"> Start Visual Studio .NET 2003, and then click New Project.</li> Click Visual C# Projects, click Class Library, type AutoSend for the name, and then click OK.</li> In Solution Explorer, right-click References, and then click Add Web Reference.</li> 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:// /mscrmservices/2006/crmservice.asmx

</li> Change the value in the Web reference name field to CrmSdk .</li> <li>Click Add Reference.</li> <li> Add the following using statement. using AutoSend.CrmSdk; </li> <li> 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(&quot;FD80F8E8-C852-DA11-B1FB-0007E94D105B&quot;);

SendEmailRequest req = new SendEmailRequest; req.EmailId = campaignActivityID; req.TrackingToken = &quot;&quot;; req.IssueSend = true;

try {               SendEmailResponse res = (SendEmailResponse)service.Execute(req); }           catch (System.Web.Services.Protocols.SoapException er) {               // Process any error messages here. }

} </li> <li>After you change the service.CallerIdValue.CallerGuid line, click Build, and then click Build Solution.</li> <li>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

</li></ol> </li> <li>Add the assembly information to the Workflow.config file: <ol style="list-style-type: lower-alpha;"> <li>Click Start, point to Programs, point to Administrative Tools, and then click Services.</li> <li>In the Services window, right-click Microsoft CRM Workflow Service, and then click Stop.</li> <li>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

</li> <li> In the methods node, paste the following information. <method name=&quot;E-mail&quot; assembly=&quot;AutoSend.dll&quot; typename=&quot;AutoSend.Class1&quot; methodname=&quot;SendEmail&quot;> <parameter name=&quot;E-mailId&quot; datatype=&quot;lookup&quot; entityname=&quot;email&quot;/> </li> <li> Change the first line of Workflow.config file to the following. <workflow.config xmlns=&quot;http://microsoft.com/mscrm/workflow/&quot; allowunsignedassemblies=&quot;true&quot;> </li> <li>Save the file, and then close it.</li> <li>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.</li></ol> </li> <li>Create a workflow rule that calls the Microsoft .NET assembly to send the e-mail activities: <ol style="list-style-type: lower-alpha;"> <li>On the Microsoft CRM Web server, click Start, point to Programs, point to Microsoft CRM, and then click Workflow Manager.</li> <li>In the Entity Type list, click E-mail, and then click New.</li> <li>In the Name field, type Send Campaign E-mail. In the Event box, leave Create selected, and then click Next.</li> <li>Click Insert Condition, and then click Check conditions.</li> <li>Click add conditions here, click Insert Condition, and then click Check entity condition.</li> <li>In the Field list, click Campaign E-mail, click the equal sign, and then click the lookup button.</li> <li>In the Static Value list, click Yes, and then click OK two times.</li> <li>Click Insert Condition, and then click Check entity condition.</li> <li>In the Field list, click Direction, click the equal sign, and then click the lookup button.</li> <li>In the Static Value list, click Outgoing, and then click OK two times.</li> <li>Click add actions here, click Insert Action, point to Call assembly, and then click E-mail.</li> <li>In the Action Name box, type Send Campaign E-mail .</li> <li>Double-click the E-mailId parameter, click Dynamic Value, leave E-mail selected in the Entity box, and then click OK two times.</li> <li>Click Save.</li> <li>Right-click the newly created rule, and then click Activate.</li></ol> </li> <li>Test the rule. To do this, create a new campaign e-mail activity, and then set the Campaign E-mail field to Yes: <ol style="list-style-type: lower-alpha;"> <li>In Microsoft CRM, select a test account record, click Create Quick Campaign, and then click For Selected Records.</li> <li>Click Next, and then type Test Quick Campaign in the Name text box.</li> <li>Click Next, click E-mail, and then click Next.</li> <li>In the Subject box, type Test E-mail, and then type Test in the body of the e-mail.</li> <li>In the Campaign E-mail field, click Yes, and then click Next.</li> <li>Click Create, and then verify that the e-mail activity has been sent.</li></ol> </li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; 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.

<div class="references_section">