Microsoft Dynamics CRM and sample code: Think First

January 11, 2010 by Imad HAJJAR

Here’s one of my favorite samples floating around in the CRM world:

         image

I have seen this code numerous times and before explaining what’s wrong (actually everything is wrong, besides the alerts), I want to tell you a story, which is also told by the above code.

You enter a mall and buy a basket, because you want to see if there is an apple in it. However, after leaving the mall you throw the basket away without using it. Back at home you search for an existing basket, take the first apple out of it and try to figure out if it is red. You then wonder why you cannot determine the color, because you forgot to check if there was a basket at all.

That’s what the code does!

  1. There is no reason to initialize the lookup variable with a new Array when setting it to null in the next line. This is the basket you are buying and instantly throwing away.
  2. Even setting it to null is nonsense when setting it to crmForm.all.customerid.DataValue afterwards.
  3. The DataValue property is null if no value is stored in a lookup field. Therefore accessing lookup[0] results in a null reference exception if DataValue equals null, because the lookup variable then will be null as well. It is the same as grabbing the first apple from a basket without having the basket first.
  4. If there is a value stored in the lookup field, then lookup[0] won’t be null. The only way it could be null is you setting it to null in code (crmForm.all.customerid.DataValue[0] = null), but that would be like writing var circle = null and wondering why circle.radius doesn’t work.

To summarize: samples are great. But be sure to understand what they do first.

Cheers,

Michael Höhne

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

Microsoft Dynamics CRM – Advanced Workflows

January 11, 2010 by Imad HAJJAR

Microsoft Dynamics CRM provides very powerful workflow designer tools to create workflows for various business scenarios. Waiting workflows are one of them. Very often, it is required to create waiting workflow on dates. So if a date is changed the waiting workflow remains in waiting state and date change executes another waiting workflow. So this aggregation of workflows affects CRM Server performance and application functionality.

Recently I created a custom workflow activity to stop these waiting workflows in a recursive workflow. So I would like to share my experience with all of you.

I am in a condition to create a waiting workflow to reschedule my activity periodically such as in recurring appointments, Auto Reorder (Sales Order), etc. My workflow is fired on Create of activity/Order and on change of Next Due date/Next Order Date. So if the user has changed Next Due Date or Next Order Date, the workflows in waiting remains in waiting and also a new Waiting workflow is fired. My aim is to stop the existing workflow as it is invalid now and start a new waiting workflow with updated information.

My workflow name is Auto Reschedule Activity. Here is the description of my workflow:

Start:

    Wait for Next Due Date == Today

         Reschedule Activity Accordingly

         Recursive Call: Auto Reschedule Activity

End

What i am looking for is:

Start:

     Check if there is an existing workflow with same Workflow ID, Entity ID and in Waiting State.

          Then Kill that workflow.

     Wait for Next Due Date == Today

          Reschedule Activity Accordingly

          Recursive Call: Auto Reschedule Activity

End

So I started with a custom Activity to fetch workflows in waiting state with same name and regardingobjectid:

I created a query object in my custom workflow activity:

QueryExpression query = new QueryExpression();

query.EntityName = “asyncoperation”; 

query.ColumnSet = cols;

And created 3 conditions as below:

ConditionExpression c1 = new ConditionExpression();

c1.AttributeName = “name”;

c1.Operator = ConditionOperator.Equal;

c1.Values = new Object[] {‘My workflow Name’}; //Workflow

ConditionExpression c2 = new ConditionExpression();

C2.AttributeName = “statecode”;

C2.Operator = ConditionOperator.Equal;

C2.Values = new Object[] {1}; //Waiting

ConditionExpression c3 = new ConditionExpression();

C3.AttributeName = “regadingobjectid”;

C3.Operator = ConditionOperator.Equal;

C3.Values = new Object[] {context. PrimaryEntityId}; //Waiting

Now I have all the waiting workflows regarding my activity. Ideally there will be only one workflow in waiting state all the time. This workflow will be responsible for rescheduling.

Now is the time to kill the outdated workflow. Use code like this for setting that workflow to complete/cancelled.

foreach (BusinessEntity be in bec.BusinessEntities)

{

asyncoperation async = (asyncoperation)be;

async.statecode = new AsyncOperationStateInfo();

async.statecode.Value = AsyncOperationState.Completed;

service.Update(async);

}

Note that you can improve this workflow utility to add lot more functionality to the workflow designer. Workflow is also described in the Microsoft Dynamics CRM SDK.

Cheers,

Ayaz Ahmad

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

Accelerators: Microsoft Ties Dynamics CRM to Twitter

January 11, 2010 by Imad HAJJAR

Accelerators: Microsoft Ties Dynamics CRM to Twitter

image When it comes to Microsoft Dynamics CRM Accelerators, sometimes it’s hard to keep up with the new stuff. The accelerator program is conducted by people who love the CRM product. From the CodePlex site we learn:

CRM Accelerators are a range of add-on solutions developed for Microsoft Dynamics CRM 4.0 customers and partners. Each accelerator is available at no cost and will showcase how the Microsoft Dynamics CRM 4.0 platform can be configured and extended to broaden marketing, sales and service capabilities. Microsoft Dynamics CRM customers and partners are encouraged to further extend these accelerators to meet their specific business needs. Each accelerator will be fully supported as per any other customization for Microsoft Dynamics CRM that follows SDK guidelines. Additionally, all samples are supplied with full source-code so they can be extended further to meet specific customer requirements.

This summer one of the more interesting Accelerators was highlighted on About.com’s Computing Center:

“Microsoft has integrated its Dynamics CRM (customer relationship management) software with Twitter, in just the latest move by an enterprise software company to latch onto the wildly popular micro-blogging service.

The social-networking accelerator — part of three new add-on modules Microsoft is releasing for Dynamics CRM — culls and catalogs relevant Twitter messages, such as a discussion about the Dynamics user’s company, and provides various analytic tools.

The integration, announced Thursday, is also meant to help Dynamics users boost their sales databases. Twitter usernames can be converted into a Dynamics CRM customer record or sales lead, to which more data, such as a phone number, can be added over time.”

Read more…

The latest news:

     – November 6 2009: Interim set of updated SQL 2005 Dashboards released for Analytics Accelerator R2, please review and provide feedback!

     – October 19 2009: Social Networking accelerator has been released!

     – October 13 2009: Portal Integration and Partner Relationship Management accelerators have been released!

Enjoy,

JaAG

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

Data Integration/Migration using SQL Integration Services (SSIS) 2008

January 4, 2010 by Imad HAJJAR

I wrote a blog article last year on how to integrate Microsoft Dynamics CRM using SQL Integration Service (SSIS) 2005 (http://tiny.cc/BQiiR) . I hope that article provided you with an alternative solution for your integration/data migration project with CRM. Due to the limited capabilities in SSIS 2005 with CRM web services, we created a proxy class as a work around to provide easy access to the CRM API.

With the new release of SQL server 2008, there were few improvements that simplify the integration of SSIS and CRM. It does not require you to create the proxy class anymore since SSIS 2008 allows you to add web references within the script component object. It also allows you to code in the language that I like the most, C#.

Here I would like to share how to leverage SSIS 2008 to integrate with CRM without the proxy class so that you can use it on your next CRM data integration/migration project.

Before we get started, here’s the list of requirements:

  • SQL Server 2008 Standard/Enterprise Edition with SQL Integration Service Installed
  • Microsoft Dynamics CRM 4.0
  • Visual Studio 2008 Professional Edition SP 1 with Business Intelligence Tools Installed
  • CRM SDK and C# knowledge

In this blog, I will use an example to show you how to send contact data stored in an Excel document to MSCRM 4.0 via CRM Web Services using SSIS.

Source Data

Source data is data from the other system that you would like to send to the CRM system. Your source data can be a text file, a database, etc… Since we often use Excel to collect our information, I will use a simple Excel document as my source data for this blog article.

Source Data: Excel Spread Sheet

image

Create SSIS Package

Launch Visual Studio 2008 to start a New Integration Services Project

After creating the project, follow the steps below to set up the SSIS package.

- Rename Package.dtsx to Contact.dtsx

Add Control Flow Items

Drag and drop a “Data Flow Task” from the Toolbox to the Control Flow Design Pane.

image

Add Data Flow Items

Double click on the Data Flow Task item that you just added and it will take you to the Data Flow Design Pane. Here we will specify the source data and also to write script to send data to CRM.

Specify Source Data

- Since our source data is an Excel document, drag and drop the Excel Source from the Toolbox to the design pane.

- Double click Excel Source to open the Excel Source Editor.

- Click New… button to open the Excel Connection Manager to specify the Excel file path, and then click OK.

image

- Select “Table or View” from Data access mode dropdown box.

- Select “Sheet1$” from Name of the Excel sheet dropdown box.

- Click OK to close the Excel Source Editor window.

Setup Script Component

- Drag and Drop Script Component to the design pane.

- Select Transformation and then click OK.

- Connect the two shapes by dragging the green arrow from Excel Source to Script Component.

- Double click the script component to open up the Script Transformation Editor.

- Select the columns that you would like to send to MSCRM from the Input Column window. In this example, I selected First Name, Last Name, Phone and Email Address.

- Remove Output in the Inputs and Outputs section since we are not going to output anything in this example.

- Click on the Script tab, click on Edit Script button. The Visual Studio window should open.

image

Add CRM Services

Since SSIS 2008 allows you to add web references in the Script Component, we will add the two web service references in this step. Please be aware that you must save the script component project by clicking the Save button on the toolbar after you added the CRM web references, otherwise the web references will not load next time you reopen the script component.

- Right click on the project in the Project Explorer window.

- Select Add Web Reference… from the menu.

image

- Repeat the steps above to add the CRM metadata service if necessary.

Coding the Package

In order to use the web reference in our code, we need to include the CrmSdk web reference to the script component project. To get the script component namespace, right click on the project and select Properties… from the menu. The namespace is in the Default namespace textbox. In this example, my script component name space is SC_ad0e4b91cb7e48cdb8fa2d240e3e5c30.csproj.

image

I added the following statement to my project.

using SC_ad0e4b91cb7e48cdb8fa2d240e3e5c30.csproj.CrmSdk;

Lastly, copy and paste the following code to the ScriptMain section:

private CrmService service = null;

    public override void PreExecute()
    {
        base.PreExecute();

        CrmAuthenticationToken token = new CrmAuthenticationToken();
        token.AuthenticationType = 0;
        token.OrganizationName = "AdventureWorkCycles";

        service = new CrmService();
        service.Url = "http://localhost/mscrmservices/2007/crmservice.asmx";
        service.CrmAuthenticationTokenValue = token;
        service.Credentials = System.Net.CredentialCache.DefaultCredentials;
    }

    public override void PostExecute()
    {
        base.PostExecute();
    }

    public override void ContactInput_ProcessInputRow(ContactInputBuffer Row)
    {
        contact cont = new contact();

        if (!Row.FirstName_IsNull)
        {
            cont.firstname = Row.FirstName;
        }

        if (!Row.LastName_IsNull)
        {
            cont.lastname = Row.LastName;
        }

        if (!Row.Phone_IsNull)
        {
            cont.telephone1 = Row.Phone;
        }

        if (!Row.Email_IsNull)
        {
            cont.emailaddress1 = Row.Email;
        }

        service.Create(cont);
    }

 

Execute the SSIS package

After coding the SSIS package, right-click on the Contact.dtsx package and then select Execute Package. After the package has executed successfully, you should see the records in CRM.

image

Deploy the SSIS Package

After successfully testing the package, deploying the package is pretty easy. It requires the same steps as the previous version of SSIS. I have included the steps again below.

- Right-click on the CRM 4.0 SSIS project and then select Properties.

- Click on the Deployment Utility tab and set the Create Deployment Utility property to True.

image

- Recompile the CRM 4.0 SSIS project. You should see CRM 4.0 SSIS.SSISDeploymentManifest in the bin\Deployment folder.

- Double-click on the manifest file and follow the wizard to deploy the SSIS package to your SQL server.

Summary

That’s all there is to it! Hopefully you have gotten the idea of how to use the latest version of SSIS to send data to CRM. SSIS 2008 has a lot of improvements to make our jobs easier to integrate systems. In this sample, I only demonstrated how to import records in CRM. In an actual data integration or migration implementation, we still have a lot more to consider such as updating, deleting and error handling. This is one of the many approaches that you can use to integrate/migrate data with CRM. I hope this will help you in your next CRM project.

Cheers,

Darren Liu

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

Marketing Lists – Newly Discovered Attributes

January 4, 2010 by Imad HAJJAR

There are many attributes that come with the CRM system. Most of them have been published on the forms from the get go when you open up the application. The remaining ones have been created in the schema and await our use in customizing an entity form. While doing some work for a new project I happened across 3 attributes in the Marketing List entity I didn’t realize existed. I immediately put one of them to use – Members Count.

The task I was working on was to quickly see the effect of removing or adding contacts from a particular marketing list as I adjusted the count for a post card mailing we were planning on executing. The typical way this would be done is to make the adjustment to the list and then either:

1. Page through each screen in the Form to then multiply the number of records times the number of full pages of records and then add the remaining partial page count.

2. Export to Excel using the Static Worksheet with “Records from all pages in the current view” option. When Excel opens up with the list of records, scroll down to the last row and subtract by one to get the count. Another version of this approach is to export to Excel by creating a Dynamic Worksheet and then just refresh the worksheet as needed to get the revised count.

Both of these approaches are well known work arounds for determining the total number of records returned by a View.

BUT, dumb luck being what it is I discovered three attributes that I had never explored before and one of them exactly met my immediate need – Members Count (schema name: membercount).

clip_image002

I created a new section on the Marketing List form and began testing the Members Count attribute.

Here is what I have discovered:

1. Members Count is a ‘static’ integer value which is updated only on the On Load event of the form.

2. Adding or Removing list members while the form is open doesn’t change the displayed value (see #1 above).

3. The count only includes Active Members on the list and ignores any members whose record has been deactivated, but is still associated with the list.

clip_image004

I haven’t explored the use of the Ignore Inactive List Members and Exclude Members Who Opt Out attributes yet.

I am now headed in the direction of exploring pre-existing but unpublished attributes for other entities to see what undiscovered gems might be out there.

Jerry Weinstock

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

Best practice for refreshing a Microsoft Dynamics CRM test environment

January 4, 2010 by Imad HAJJAR

For high availability Microsoft Dynamics CRM deployments, it is recommended that you have additional environments for test, Dev, and QA, so you can manage changes to your configuration without impacting users. This is also a good idea for disaster recovery, so if the production environment fails you can roll over to one of the other environments.

To have a valid test environment, you need to closely approximate your production Microsoft Dynamics CRM environment, with current configuration and data. So what is the process to “refresh” the data and configuration in your test environment to match the production environment?

Refresh a Microsoft Dynamics CRM test environment to match the production environment:

  1. Deactivate the test Microsoft Dynamics CRM organization using Microsoft Dynamics CRM Deployment Manager. On the test Microsoft Dynamics CRM server, open Deployment Manager by going to Start–>All Programs–>Microsoft Dynamics CRM–>Deployment Manager. Open the Organizations folder, select your Microsoft Dynamics CRM test organization, and then click Disable from the right side menu. Note that you must be a deployment admin to perform this step.image
  2. Delete the test Microsoft Dynamics CRM organization in Deployment Manager. After you have disabled the organization, you will be able to delete it.image
  3. Drop the test MSCRM database in SQL Server Management Studio on the test SQL Server environment.
  4. Restore the backup of the production MSCRM database to the test SQL Server environment.
  5. Import the organization to the test environment using Microsoft Dynamics CRM Deployment Manager. In Deployment Manager, click Import Organization, and follow the wizard to point it to the restored MSCRM database.

Thanks to Matt Parks and Ross Lotharius for their input. Ross notes that if you add users to the test environment that you imported, these users may get duplicated in the test configuration database and cause problems with these users logging in to the test environment. The recommendation is to either avoid adding users in the test environment (add them first to production before you import the organization into test) or restore both the MSCRM and configuration databases in step 4. Restoring the configuration database will work, as long as there are no other Microsoft Dynamics CRM organizations in the test environment.

Related Links

Cheers,

Joel Lindstrom

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

The Convergence of Microsoft Dynamics CRM and Outlook

January 4, 2010 by Imad HAJJAR

I have been running the latest release of Microsoft Dynamics CRM Client for Microsoft Outlook (Rollup 7) for over a month now (I also had the opportunity to be a beta tester for the product team for a month before it was launched) and overall it has been a big improvement in performance and reliability.  You can see the list of improvements on this blog posting http://blogs.msdn.com/crm/archive/2009/10/22/update-rollup-7-for-microsoft-dynamics-crm-4-0.aspx

The key point I want to make on this post is that we are getting there…”the Convergence of CRM and Outlook”.  I think this release is the turning point to get many more of the Microsoft Dynamics CRM users out there (you know who you are, all 1 million+ of you) to install and use the Outlook Client as their primary interface to CRM.  A couple of key turning points for me:

  • Now CRM looks to see if you have a connection to the server.  If you lose your connection, it automatically goes offline, if you get the connection back it automatically goes back online
  • It loads faster on start up and you can read email, look at your calendar etc while it is loading in the background
  • You can shut your close your laptop and reopen it and it still works without logging back into Outlook again
  • The offline client runs very fast…

Starting to work like Outlook!  Is it perfect?  No, but I have been using the Outlook Client since the humble beginnings of Microsoft CRM 1.2 and MSFT has come a long way to delivering on the promise of CRM and Outlook working together.  Just in this last month, I have tracked over 235 emails in CRM (including a nice HTML word mail merge that I sent out to a number of my key contacts about some recent news).  Outlook and CRM have now been woven together in my working style.

I work with many “low tolerance” people that dumped the Outlook Client previously for one reason or another and have seen them come back to it this time and use it.   This continues to be one of the big value propositions of Microsoft in helping to drive user adoption for CRM or any XRM application for that matter.  As complex as these solutions can become, pretty much every user still wants to use Outlook, Word and Excel to do a lot of their every day work.  The intersection of these Office tools and CRM is going to happen.

A couple of hints to make your Outlook Client experience better:

  • Drag the CRM folders that you use most often up to your favorite folders.  I think of it as CRM is now “4 Folders in my Favorite Folders in Outlook”.  I can’t imagine navigating to the bottom of my folder system to go find CRM each time
  • Make sure that email responses to your CRM emails are automatically tracked in CRM (set your settings under the Email Tab of Personal Options to “E-mail messages in response to CRM e-mail”
  • If you do have an issue, run the Diagnostics Wizard (this needs to be in an easier spot for most end users in reality) as it typically solves many of the issues you may be experiencing (Start/All Programs/Microsoft Dynamics CRM 4.0/Diagnostics/Run Diagnostics)

As Aaron Elder always reminds us “You never really arrive”.  I can say that the CRM Product Team has definitely gotten 1 step closer.

Cheers,

Aaron Elder and David Kohar

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

How to Configure Microsoft Dynamics CRM 4.0 E-mail Router (On-Premise) with Microsoft Exchange Server 2010

December 22, 2009 by Imad HAJJAR

Update Rollup 8 for Microsoft Dynamics CRM E-mail Router (On-Premise) includes support for Microsoft Exchange Server 2010. In continuation to the blog titled “Configure Microsoft Dynamics CRM Online E-mail Router with Exchange Online”, this one explains the detailed steps required to setup Microsoft Dynamics CRM 4.0 E-mail Router (On-Premise) with Microsoft Dynamics CRM 4.0 On-Premise users and queues having mailboxes in Microsoft Exchange Server 2010.

Microsoft Exchange Server 2010 replaces the WebDAV functionality with Exchange Web Services (EWS). Microsoft Dynamics CRM 4.0 E-mail Router (On-Premise) with Update Rollup 8 has been enhanced to integrate EWS support and hence function with Microsoft Exchange Server 2010. The E-mail Router maintains compatibility with Exchange 2003 (only WebDAV) and Exchange 2007 (both WebDAV and EWS).

Prerequisites

  • Microsoft Dynamics CRM 4.0 On-Premise installation.
  • Microsoft Exchange Server 2010.
  • Microsoft Dynamics CRM 4.0 E-mail Router (On-Premise) with Update Rollup 8 or higher.

Configuration Steps

Microsoft Exchange Server 2010 

Granting Exchange Impersonation permissions.

Microsoft Exchange Server 2010 makes do with the permissions model used in Microsoft Exchange Server 2007 and adopts the new Role Based Access Control (RBAC) allowing users to define extremely broad or extremely precise permissions models based on the roles of administrators and users. New commands are available to allow User/Mailbox Impersonation with varying scopes. Exchange Impersonation permission is required for a given Exchange 2010 account if it needs to cater to multiple Exchange 2010 accounts. The profile created with a user account having Exchange Impersonation permission can access the mailboxes of the users who are in the scope of this Exchange Impersonation permission.

In the Microsoft Exchange Server 2010 system, launch Exchange Management Shell from Start-> All Programs-> Microsoft Exchange Server 2010 -> Exchange Management Shell. The shell will connect to the Microsoft Exchange Server 2010 and display the prompt.

[PS] C:\Windows\System32>.

clip_image001

Example: impersonation scenarios

1. A single user is configured to connect to mailboxes of all other CRM users and queues that have their mailboxes on Microsoft Exchange Server 2010. This configuration hence makes do with the need to create profile for each CRM user and queue individually.

To achieve this you need to run the following command in Exchange Management Shell–

 

New-ManagementRoleAssignment   –Name: “ImpersonationName

-User: “RouterAdministrator@YourOrganization.com“   –Role:”ApplicationImpersonation”

 

In the above command, the Name parameter specifies a name for the new management role assignment. User is the username of the user who is given Exchange Impersonation permission and therefore can now access Exchange 2010 mailboxes of all other users in the Exchange organization.

[Details on New-ManagementRoleAssignment can be found here]

2. A single user is configured to connect to mailboxes of select set of CRM users and queues that have their mailboxes on Microsoft Exchange Server 2010. This configuration is preferable as the impersonation rights are given selectively on the desired mailboxes only.

To enable this scenario, you need to define the set of users as a Management Scope in Microsoft Exchange Server 2010. To do so, run the following command in Exchange Management Shell–

New-ManagementScope   –Name: “ManagementScopeName“ 

–RecipientRestrictionFilter { Name  -eq  ‘ crmuser1 ’ }

 

In the above command, The Name parameter specifies the name of the management scope. The RecipientRestrictionFilter parameter specifies the filter to apply to recipient objects.

[Details on New-ManagementScope can be found here]

 

The new Management Scope created can now be used in the Role Assignment command to restrict the scope of Exchange Impersonation.

New-ManagementRoleAssignment   –Name: “ImpersonationName

-User: “RouterAdministrator@YourOrganization.com“   –Role:”ApplicationImpersonation”

-CustomRecipientWriteScope: ”ManagementScopeName

 

Removing Exchange Impersonation permission.

Exchange Impersonation permission can be removed using the

Remove-ManagemntRoleAssignment command.

[Details on Remove-ManagemntRoleAssignment can be found here]

Microsoft Dynamics CRM 

Configure users and queues to use Microsoft Dynamics CRM E-mail Router.

Users and Queues in CRM can be configured to use the E-mail Router for processing the incoming Exchange and outgoing CRM e-mails. To utilize this functionality, Users and Queues must have a valid email address and select E-mail Router as the incoming and outgoing E-mail access types. This can be setup by an administrator or users having relevant permissions.

CRM Users

1. Navigate to Settings->Administration->Users and configure the user record as displayed.

clip_image002

  1. Individual users can select which e-mails from the specified Exchange On-Premise mailbox to Track in CRM. This can be selected from the Tools->Options-> E-mail tab.

clip_image003

CRM Queues

  1. Navigate to Settings->Business Management->Queues and configure the Queue as displayed.
    clip_image004
  1. In line with Users, Queue form also provides the flexibility to choose the desired category of e-mails which need to be promoted to Microsoft CRM.
    clip_image005

Microsoft Dynamics CRM 4.0 E-mail Router (On-Premise)

After the Router has been installed, launch the E-mail Router Configuration Manager from Start-> All Programs-> Microsoft Dynamics CRM E-mail Router. There are three main tabs in the Configuration Manager as shown below.

clip_image007

Configuration Profiles. To configure the E-mail Router, you first create one or more incoming and one or more outgoing configuration profiles. These configuration profiles contain information about the e-mail server and authentication methods that the E-mail Router will use to connect to the e-mail server and transfer e-mail messages to and from the Microsoft Dynamics CRM organization. You create configuration profiles on the Configuration Profiles tab in the E-mail Router Configuration Manager.

Deployments. After you create the configuration profiles that you want, you must define at least one deployment. The information that you enter into the Deployment area will be used by the E-mail Router to connect to your Microsoft Dynamics CRM deployment.

Users, Queues and Forward Mailboxes. After you have the configuration profiles and deployment established, then you manage the users, queues, and forward mailboxes that will be used by the E-mail Router to route Microsoft Dynamics CRM e-mail messages. You manage these items on the Users, Queues, and Forward Mailboxes tab in the E-mail Router Configuration Manager.

Creating Exchange Server 2010 incoming profile.

  1. In the E-mail Router Configuration Manager tool, click the Configuration Profiles tab, and then click New.
  2. Type a profile name. For example, type Exchange 2010 Incoming Email.
  3. Choose Incoming in the Direction list.
  4. Choose Exchange Web Services as the Protocol.
  5. Choose Exchange 2010 as the E-mail Server Type.
  6. The only Authentication Type allowed is “Windows Authentication”.
  7. Type the name of the Microsoft Exchange Server 2010 web services URL.

Default Location
https://<Exchange-2010-Server-Name>/EWS/Exchange.asmx

clip_image008

8. Select how the e-mail Router will gain access to the Microsoft Exchange Server 2010 in the Access Credentials list.

  • If you select Local System Account for the Profile, the Router will use the credentials specified in the Microsoft CRM Email Router service running in the host machine. The credentials provided should be the username of user in your Microsoft Dynamics CRM organization who has the System Administrator role. This user must have Exchange Impersonation permission on the mailboxes that this Incoming Profile will serve including self. This type of profile is typically used for polling large number of mailboxes using the credentials of a user with Administrative privileges and Exchange Impersonation permissions.
  • If you select User Specified for the Profile, the Router will use the user name and password provided in Microsoft Dynamics CRM for users who are configured to use this Incoming Profile.
  • If you select Other Specified for the Profile, the Router will use the user name and password provided in the open textboxes as shown below. User name has to be provided in the form DomainName\UserName. The specified user must have Exchange Impersonation permission on all the mailboxes that this Incoming Profile will serve (Exchange Impersonation Permissions on self is not required).

Note: The above steps can also be used to create an incoming profile for a CRM user having Microsoft Exchange Server 2007 mailbox by choosing Exchange 2007 as the Email Server Type in step 5.

Creating Exchange Server 2010 outgoing profile.

Microsoft Dynamics CRM 4.0 Email Router (On-Premise) with Update Rollup 8 supports SMTP as the default and only protocol for outgoing e-mail messages as in the case of previous versions.

  1. In the E-mail Router Configuration Manager tool, click the Configuration Profiles tab and then click New.
  2. Type a profile name. For example, type Exchange 2010 Outgoing Email.
  3. Choose Outgoing in the Direction list.
  4. The only Protocol allowed is SMTP.
  5. Verify that SMTP is selected as the E-mail Server Type.
  6. Choose the Authentication Type as appropriate.

clip_image009

  1. Type only the name of the Microsoft Exchange Server 2010 system in the Location field.
  2. Check SSL box if the Microsoft Exchange Server 2010 uses SSL for SMTP.
  3. Select and provide the appropriate Access Credentials with Exchange Impersonation permission as required. [See section on Granting Exchange Impersonation permission for details]

Configure the Microsoft Dynamics CRM On-Premise deployment.

After you have created the outgoing and incoming e-mail profiles, click the Deployments tab in the E-mail Router Configuration Manager tool.

  1. Click New to create a new deployment. The default Deployment option will be set to My Company.
  2. In the Microsoft Dynamics CRM Server open text box it will default to http://discovery/<OrganizationName>. Replace discovery with the name of the Microsoft Dynamics CRM On-Premise Server and <OrganizationName> with your Microsoft Dynamics CRM Organization Unique Name.
    Note: The Organization Unique Name is case-sensitive.
  3. Verify that Microsoft Dynamics CRM secure URL Port contains valid value if the CRM server is SSL enabled. clip_image010
  1. Select how the e-mail Router will gain access to the Microsoft Exchange Server 2010 in the Access Credentials list.
  •  
    • If you select Local System Account, the Router will use the credentials specified in the Microsoft CRM Email Router service running in the host machine.
    • If you select Other Specified, the Router will use the user name and password provided in the open textboxes as shown below. User name has to be provided in the form DomainName\UserName.

    5. In the Incoming configuration profile, select the incoming profile you created.

  1. In the Outgoing configuration profile, select the outgoing profile you created.
    Note: Setting the Incoming and Outgoing configuration profiles on the Deployment will make these the default profiles for the users that are set to use the E-mail Router for incoming and outgoing e-mail. You can change it for each user in the Users, Queues and Forward Mailboxes tab.
  2. Click OK to finish creating the deployment.

Forward Mailbox

Forward Mailbox is one of the options available for processing the incoming e-mails in Microsoft CRM. This option is helpful in scaling the system where all the Forward Mailbox users and queues have all their e-mails forwarded to the Forward Mailbox using Exchange forwarding rules. Emails for multiple users and queues are present in this single E-mail box as an attachment and hence Router can promote them to Microsoft Dynamics CRM using the single polling location. Users and Queues can have this options set for incoming e-mails processing as follows.

  • Users: Settings->Administration->Users
  • Queues: Settings->Business Management-> Queues

clip_image012

Set up the Forward Mailbox.

  1. Open the Microsoft Dynamics CRM E-mail Router Configuration tool.
  2. Click the Users, Queues and Forward Mailboxes tab.
  3. In the Select a CRM Deployment to view users and mailboxes list, select the Microsoft Dynamics CRM deployment you created.

clip_image013

  1. Click Load Data. This will display the Microsoft Dynamics CRM users who are configured to use the Email Router for processing their e-mails.
    Note: If you receive an error displaying the users, verify the correct organization name is listed in the Select a CRM Deployment to view users and mailboxes list. Also, verify the organization name is entered with the correct case. The organization name is case-sensitive.
    Note: If no users are listed after you click Load Data, or if you are missing users, check the user’s settings by following the steps in the section titled “Configure users and queues to use Microsoft Dynamics CRM E-mail Router.”
  2. Click the Forward Mailboxes tab, and then click the New.
  3. Type a name for the forward mailbox profile. For example type ForwardMailbox in the Name open text box.
  4. Type the e-mail address for the forward mailbox in the E-mail Address open text box.
  5. Click OK

Deploy Exchange rules manually through Microsoft Exchange Server 2010.

In order to use the forward mailbox feature Microsoft Exchange Server 2010 users need to manually create rules on their own mailboxes from OWA or using Outlook client. This can be done by using the Rule Deployment Wizard for Microsoft Exchange Server 2007 and earlier systems. In Microsoft Exchange Server 2010 they will need to manually setup a rule with the following logic:

clip_image014

Forward All e-mails as An Attachment to <a mailbox you defined in your system>

This rule will forward all incoming e-mail to the Microsoft Dynamics CRM forwarding mailbox. After the rules have been deployed, any e-mail that is received in a user’s mailbox will be forwarded as an attachment to the forwarding mailbox. The Microsoft Dynamics CRM E-mail Router Service monitors the forward mailbox. The service will route Microsoft Dynamics CRM e-mail to Microsoft Dynamics CRM as an e-mail activity. If the e-mail is not related to Microsoft Dynamics CRM, the service will delete the e-mail message from the forwarding mailbox.

Test and publish the new incoming /outgoing profiles and deployment.

The final step is to publish new incoming profiles, the deployment and forward mailbox settings. Before publishing, connectivity to all mailboxes using the specified profiles must be tested. To do this, complete the following steps:

  1. Click the Users, Queues and Forward Mailboxes tab within the E-mail Router Configuration Manager tool.
  2. In the Select a CRM Deployment to view users and mailboxes list, select the Microsoft Dynamics CRM deployment you created.
  3. Click Load Data. This will display the Microsoft Dynamics CRM users configured to use the e-mail Router. clip_image015

Note: If you receive an error loading the data, verify the correct organization unique name is listed in the Select a CRM Deployment to view users and mailboxes list. Also, verify the organization unique name is entered with the correct case. The organization unique name is case sensitive. If no users are listed after you click Load Data, or if you are missing users, check the user’s settings. Also Forward Mailbox users and queues do not have the option of assigning the incoming profiles because the forward mailbox is directly used for the incoming E-mail processing.

  1. If you want to change the Incoming or Outgoing configuration profiles for certain users, double click the user and change the selection for the Incoming Configuration Profile or Outgoing Configuration Profile and click OK.
  2. Click Test Access. Tests will be performed on all users for both profiles. A successful test will display a green succeeded message that resembles the following:
    clip_image016
  3. To publish the deployment, click Publish. A successful publish will display the following message: 

clip_image018

On publishing the Router will start catering the Microsoft CRM Users and Queues having the Microsoft Exchange Server 2010 mailboxes.

Cheers,

Ravindra R Upadhya

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

Using the Microsoft Translator inside Microsoft Dynamics CRM v4

December 22, 2009 by Imad HAJJAR

This customization is designed to call the ‘Microsoft® Translator’ service from within CRM. This example uses a custom button, included in an entity form, to call the service and translate text (which has been selected by the user) into another language.

This document describes the steps required to include the custom button on a form, how to call the service and how to set the language of both the source and target text.

NOTE: This customization is designed for use with Internet Explorer (IE) 7 or higher.

Adding the “Translate” button to a form

- Navigate to “Settings\Customizations\Export Customization”

- Select “ISVconfig” and click on “Export Selected Customizations”

- Save the “customizations.zip” file to a convenient location and expand it so that you can edit the customizations.xml file.

- Add these lines to the toolbar section for your chosen entity:

<Button Icon="/_imgs/ico_18_debug.gif" JavaScript="crmTranslator.TranslateText()">
<Titles>
<Title LCID="1033" Text="ToolBar Translate" />
</Titles>
<ToolTips>
<ToolTip LCID="1033" Text="Translate selected text" />
</ToolTips>
</Button>

- Now, click on “Import customizations” and upload the customizations.xml file

- Publish your customizations

- Navigate to “Settings\Administration\System Settings” and in the “Customizations” tab ensure that the client you intend to view this customization with is selected.

You should now be able to see the button on your chosen form.

          clip_image002

Changing the Title and Tooltip text of the button

To change (edit) the text that appears in the button, or the tooltip, simply change the highlighted portions as indicated below:

<Button Icon="/_imgs/ico_18_debug.gif" JavaScript="Tx_Selected();">
<Titles>
<Title LCID="1033" Text="ToolBar Translate" />
</Titles>
<ToolTips>
<ToolTip LCID="1033" Text="Translate selected text" />
</ToolTips>
</Button>

You will again need to ‘import’ and ‘publish’ the customization before you will see your changes.

If localizing the Title and Tooltip, you should also change the LCID reference when editing the text. The example here shows a change to the French LCID:

<Button Icon="/_imgs/ico_18_debug.gif" JavaScript="Tx_Selected();">
<Titles>
<Title LCID="1036" Text="Traduire" />
</Titles>
<ToolTips>
<ToolTip LCID="1036" Text="Traduire du texte sélectionné" />
</ToolTips>
</Button>

In a multi-lingual deployment of CRM (where additional language packs are installed) you may want the button text and tool tip to change based on a user’s language settings. In this case you will need to add a new Locale ID (LCID) line for each language you’d like to included, both in the Title and Tooltip section. In the below example, both English and French are included:

<Button Icon="/_imgs/ico_18_debug.gif" JavaScript="Tx_Selected();">
<Titles>
<Title LCID="1033" Text="ToolBar Translate" />
<Title LCID="1036" Text="Traduire" />
</Titles>
<ToolTips>
<ToolTip LCID="1033" Text="Translate selected text" />
<ToolTip LCID="1036" Text="Traduire du texte sélectionné" />
</ToolTips>
</Button>

 

For a full list of Locale ID codes (LCID Dec) assigned by Microsoft, please see the reference on the Microsoft Developer Network. http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

Adding the “Powered by” gif to the translation window

To add the “poweredby.gif” image to the translation window, you should create a folder for your customization in the “CRMWeb\ISV folder on your server, for example “CRMWeb\ISV\CRMTranslator”. “Copy the gif file (poweredby.gif) included in the download into to this folder.

                clip_image004

Add the code to the form’s OnLoad() function

You have specified the script action “crmTranslateSample.TranslateText()”, so you now need to define this. You need to firstly define the function in the forms “OnLoad()” event. Then create the namespace “crmTranslateSample” and attach the function. This is done to safeguard against upgrades and QFE’s potentially introducing CRM functions with the same name which we could then break with our duplicate function name – for more info and another example see this blog post: http://blogs.msdn.com/crm/archive/2009/06/08/new-dependent-picklist-sample.aspx

 

NOTE: You will need you own Developer AppId to supply in the call to “Translate” (see info here: http://social.msdn.microsoft.com/Forums/en-US/microsofttranslator/thread/07fdad5c-82b9-4646-9d4a-48e580b89862 )

 

- Navigate to “Settings\Customizations\Customize Entities”

- Click on the entity to whose form you want to add the translator – for example: “account”

- When the web dialog opens, click on “Forms & Views” and double-click on “Form” – the main application form.

- Click on Form properties

- In the “Event list”, select “OnLoad()” and click “Edit”

- Add the code in the attached CrmTranslatorCode.txt to this event editor, this consists of

  1. Tx_Selected() – the function which does the work
  2. Definition of the crmTranslator object to use as a namespace, and couple of lines to:
  •  
    • Attach the Tx_Selected() function to this namespace (as crmTranslator.TranslateText)
    • Attach the namespace to the window so that it is available when the button calls it.
//
// Tx_Selected, function where the work is done
//
//
Tx_Selected = function()
{
   // Provide your own Application ID.
    var appId = "YOUR APP ID";
      var paramString = "http://api.microsofttranslator.com/V1/Http.svc/Translate?";
      paramString += "appId=";
      paramString += appId;
      paramString += "&from=en&to=es";

   // Get the text to be translated.
   var selectionObject = document.selection;
   if (selectionObject.type == 'Text')
   {
      try
      {
          var selectedText = selectionObject.createRange();

         var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
         xmlhttp.open('POST', paramString, false);
         xmlhttp.setRequestHeader('Content-type','text/plain');
         var ret =   xmlhttp.send(selectedText .text);
         var msg = '<table border="1"><tr><td   WIDTH=450>';
         msg += xmlhttp.responseText;
         msg += '</td></tr></table>';
       }
      catch (e)
      {
          var msg = "<p>There was a problem with the Search</p>";
          if (e.number == -2146828218)
           {
               msg += "<p>Your Internet Explorer security settings ";
               msg += "for this zone do not allow ";
               msg += "access to data sources across domains. </p>";
               msg += "<p>You must set your Internet Explorer ";
               msg += "security settings to allow access ";
               msg += "to data sources across domains. ";
               msg += "For more information see ";
               msg += "<a href='http://www.microsoft.com/windows/ie/";
               msg += "ie6/using/howto/security/setup.mspx#EQCAC' ";
               msg += "Target='_blank' >Setting Up Security Zones";
               msg += "</a>.</p>";
           }
      }

      txWindow = window.open("", "mywindow","status = 0, scrollbars = 1, height = 200, width = 500,  resizable = 0");

      txWindow.document.write('<img src="/ISV/CRMTranslator/poweredby.gif" alt="" />');
      txWindow.document.write('<br/><br/>');

       //write the text to the window in a table
      txWindow.document.write(msg);
      txWindow.document.write('<br/><br/>');
      txWindow.focus();
    } //end of the 'if' block
}

//Create an arbitrary object to serve as a namespace
var crmTranslator= new Object();

//Attach the function to the crmTranslator
crmTranslator.TranslateText = Tx_Selected;

//Attach the crmTranslatorto the window so it is globally available
window.crmTranslator = crmTranslator;

 

- Ensure that the Event is enabled checkbox is checked and click “Ok”

- Click “Ok” on the “Form Properties” dialog also

- Save and Close your form

- You will, again, need to ‘publish’ this customization before it is usable.

The CRM SDK is available here http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=82e632a7-faf9-41e0-8ec1-a2662aae9dfb

You should find the crmsdk4.chm file which comes with a useful reference guide especially the sections like “Customization Best Practices”, “Accessing Web Services in Jscript” and “ISV.Config XML Reference”

For another code example and more information on the consumption of external web services from within a CRM form, see this blog post http://msdn.microsoft.com/en-us/library/cc150839.aspx

Setting the source and target languages

In the example given, the “from” parameter is set for English source text to be translated into Spanish:

(“from=en&to=es”).
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      xmlhttp.open('POST', 'http://api.microsofttranslator.com/V1/Http.svc/Translate?appId=YourAppID&from=en&to=es', false);

To change the source/target languages you need to edit the form Onload () function to reflect the desired languages – for example, “from=de&to=fr” for German source text to be translated to French.

It is important that you use languages which are;

a) supported by the service, and

b) you must use the recognized ISO 639-1 language code:

            image

 

 

Using the “Translate” button

The example given here is in the Accounts form, but the process is the same for any entity.

- Navigate to “Workplace\Accounts” (or the entity you have included the function in)

- Open any record

- Select the text in any free text field or edit box, on any tab (in the example we’ve highlighted the “Description” text on the “Details” tab

                 clip_image006

- Click on the translation button in the toolbar.

                 clip_image008

- Microsoft Translator is invoked and the returned translation is displayed in a pop-up as follows (i.e.; the selected text is translated to Spanish)

                 clip_image010

Any and all use of the Microsoft Translator service must be in full compliance with the Live Services ‘Terms of Service’ (http://dev.live.com/terms/) and specifically the Microsoft Service Agreement here-http://help.live.com/help.aspx?project=tou&mkt=en-us.

For more information on the use of the MS translator see: http://msdn.microsoft.com/en-us/library/dd576287.aspx

Cheers,

Dermot Boyle

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner

Update Rollup 8 for Microsoft Dynamics CRM 4.0

December 22, 2009 by Imad HAJJAR

The Microsoft Dynamics CRM Sustained Engineering team will release Microsoft Dynamics CRM 4.0 Update Rollup 8 on Thursday, December 17, 2009.

Once the release is available the links below will take you to the necessary information about Update Rollup 8.

General Details about Update Rollup 8

  • Update Rollup 8 is cumulative. However, the Update Rollup 8 CRM Client and Data Migration Client packages require Update Rollup 7 to be installed. For all other CRM components you do not need to install any previous Update Rollups prior to Update Rollup 8
  • The Update Rollup 8 download contains updates for the 40 supported Language Packs. Prior to installing the Update Rollup 8 Language pack you must install the original Language pack.
    • If you have Language Packs installed, you should
  1.  
    1.  
      1. Download the Update Rollup 8 Language Pack
      2. Install the Update Rollup 8 Language Pack
      3. De-provision the Language Pack
      4. Re-provision the Language Pack
  • Information about how to avoid reboots when installing the CRM Outlook Client can be found in the Update Rollup 4 blog posting.
  • The Update Rollup 8 Client can be deployed before the server is upgraded to Update Rollup 8.
  • Steps to make the Update Rollup 8 Client available via AutoUpdate can be found in the Update Rollup 4 blog posting. The Link and Patch IDs can be found in kb article 975995.

Microsoft Dynamics CRM E-mail Router

Update Rollup 8 adds support for Exchange 2010. However, the Update Rollup 8 Rule Deployment Wizard does not yet support Exchange 2010. We are working to add that support in future Update Rollups.

How to get support for Update Rollup 8

To get support please contact Microsoft Product Support. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS

Note: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Cheers,

Matt Brown

Simplify your life with JavistaCRM

CRM for iPhone

Download JavistaCRM on iPhone v1.5

Start your trial experience of JavistaCRM

FAQ concerning JavistaCRM

Question, Feedback or to be a partner