Request a topic or
contact an Arke consultant

Arke Systems Blog

Useful technical and business information straight from Arke.

About the author

Author Name is someone.
E-mail me Send mail

Recent comments




The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2019

Microsoft Dynamics CRM 4.0 Update Rollup 4 released

Why is seems like just yestarday we were posting about Update Rollup 3, and here comes Rollup 4!


You can find the KB article here: 

The actual files are here:  

Don't forget the updated help files!

One quick addendum, make sure you clear your Internet Explorer cache after installing on both the server and the client side.

Posted by Wayne Walton on Monday, May 11, 2009 2:16 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Out of order CRM Annotations (Notes)

One of my import tools was having a problem where annotations were showing up sorted … oddly.  It would show for example annotations 4,5,6, and 7 followed by annotations 1, 2, and 3. 

Turning on trace shows that annotations were being selected from the database with a simple orderby createdon desc.  Sounds reasonable, sort by date, date should be uniquely ordered…

Repeat after me: CRM dates have no milliseconds. CRM dates have no milliseconds. CRMDateTime is a day + hh:mm:ss.  No milliseconds.

So, the createdon date was being truncated to the second, so any annotations that were created by my import tool during the same second all had the same value.  That leaves sql server with no particular directions for sorting them, so it picks the order it found them in, which happens to be the order they were created… so any annotation created within the same second sorts in creation order, then those are sorted in reverse creation order with other groups of annotations from other seconds. 

The solution is to put a second between annotation creations when importing if select order is going to be important.  If you don’t want to actually slow down your importing by a second every time you have a string of annotations, you can use the overriddencreatedon property to feed in adjusted-by-seconds times, but you have to count backwards because you can’t set a createdon date in the future.

Easy way:


Hard way: (make sure the clock of whatever system you are running on is synced properly)

/// <summary>
/// Creates a CRM annotation 
/// </summary>
/// <param name="subject">Up to 500 chars, will be trimmed if necessary.</param>
/// <param name="text">Up to 5000 chars, will be trimmed if necessary.</param>
/// <param name="owningentitytypename">EntityName.[entity].ToString()</param>
/// <param name="owningentityguid">GUID.</param>
/// <param name="createtimeoffsetseconds">Usually this should be 0.  Must be 0 or negative, can't create things in the future.</param>
/// <param name="previousannotations">If previousannotations is specified, new annotation will be added with a 
/// create time 1 second before the earliest createtime in "previousannotations" list.  
/// When displayed in normal reverse chronological order, they will display in the 
/// actual order added by this method - which means you will usually want to add them 
/// in reverse chronological order also.</param>
/// <returns></returns>
public static annotation addAnnotation(string subject, string text, string owningentitytypename, Guid owningentityguid, int createtimeoffsetseconds, LinkedList<annotation> previousannotations)
    annotation annote = new annotation();
    // todo: determine how to not need to hardcode 500/5000.
    annote.subject = GetTrimmedIfNeeded(subject, 500);
    annote.notetext = GetTrimmedIfNeeded(text, 5000);
    annote.objectid = new Lookup();
    annote.objectid.type = owningentitytypename;
    annote.objectid.Value = owningentityguid;
    annote.objecttypecode = new EntityNameReference();
    annote.objecttypecode.Value = owningentitytypename;
    annote.isdocument = new CrmBoolean();
    annote.isdocument.Value = false;
    DateTime when = DateTime.Now.AddSeconds(1 + createtimeoffsetseconds);
    if (previousannotations != null && previousannotations.Count > 0)
        foreach (annotation a in previousannotations)
            CrmDateTime comp = a.createdon ?? a.overriddencreatedon;
            if (comp != null)
                if (comp.UserTime.CompareTo(when) < 0)
                    when = comp.UserTime;
    annote.overriddencreatedon = CrmHelper.ConvertToCrmDateTime(when.AddSeconds(-1 + createtimeoffsetseconds));
    return annote;

public static annotation addAnnotation(string subject, string text, string owningentitytypename, Guid owningentityguid)
    return addAnnotation(subject, text, owningentitytypename, owningentityguid, 0, null);

/// <summary>
/// Overly fancy trimming function that trims text down to fit in length.
/// Tries to include a note indicating that trimming was done.  
/// Note is longer if more space is available.
/// Examples:
/// ?CrmHelper.GetTrimmedIfNeeded("01234567890123456789012345678901234567890123456789", 5)
/// "01234"
/// ?CrmHelper.GetTrimmedIfNeeded("01234567890123456789012345678901234567890123456789", 6)
/// "01234*"
/// ?CrmHelper.GetTrimmedIfNeeded("01234567890123456789012345678901234567890123456789", 11)
/// "01234567..."
/// ?CrmHelper.GetTrimmedIfNeeded("0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 51)
/// "012345678901234567890123456789012345678901(trimmed)"
/// ?CrmHelper.GetTrimmedIfNeeded("012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 151)
/// "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678(trimmed to 151 chars)"
/// </summary>
/// <param name="str">String to maybe trim</param>
/// <param name="length">Max length after trimming, including trim note (if any)</param>
/// <returns>String no longer than length, maybe trimmed, maybe with a note indicating the trimming was done.</returns>
public static string GetTrimmedIfNeeded(string str, int length)
    if (str.Length > length)
        string trimmedwarning="";
        if (length > 150) {
            trimmedwarning="(trimmed to " + length + " chars)";
        } else if (length > 50) {
        } else if (length > 10) {
        } else if (length > 5) {
        int warninglength = trimmedwarning.Length;

        return str.Substring(0, (length-warninglength)) + trimmedwarning;
        return str;

Posted by David Eison on Friday, April 10, 2009 3:23 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Microsoft Dynamics CRM 4.0 Update Rollup 3 released

While at Convergence last week, Microsoft went ahead and released Update Rollup 3 for CRM 4.0.  You can get it here.

A few important notes:

  • Importing and exporting customizations is supported between servers with Update Rollup 2 and 3, but not supported between Release, Rollup 1 and Rollup 3. 
  • The CRM for Outlook Client has some memory usage issues resolved.
  • Performance issues with CRM related to the email router have been resolved.

Categories: CRM
Posted by Wayne Walton on Tuesday, March 17, 2009 10:26 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Unable to load client print control – SSRS and CRM

After some Googling, I came across this forum post:

Basically a hotfix KB956391 broke the client control for SSRS.  We had already installed all the latest automatic updates on all the servers, but the following update isn’t presented with Windows Update.

Installing this fix on ALL* related servers, then rebooting fixed the problem.  (*You can’t just install it on the SSRS machine, you need to install it on any server that allows a client to connect to reporting services.) 

Basically, this fix forces the browser to download the latest client viewer and install it.  I had found a number of other solutions that required a manual installation on the client’s computer, but this one works from the server side.

Categories: CRM | SQL Server | SSRS
Posted by Trenton Adams on Wednesday, March 11, 2009 5:53 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Importing related records in CRM from CSV

So it is a common issue that when new CRM clients (especially CRM Online clients) come online, they have data they need to import.  Well, not all of them have proper databases, or even really a budget to get a custom-developed import solution, or Scribe.  Well, we've put together a budget-oriented method that can help.

First off, the most common issue is that the client has their info in just one big Excel file.  Contacts, Company, Notes and maybe even Opportunities are all in one big flat file.  Well obviously that won't do for CRM.  However, if you just break them up into different files and upload, they aren't associated with one another.  Now if you only have a few dozen contacts and companies, it might be ok to go in after the fact and set them manually, but that's not going to be a viable solution for most.  So we need a way to associate all these different entities.

Fortunately, CRM makes a unique identifier for every record it creates (called a GUID), and we can use this record to tie record types together.  However, to do this, you're going to need a couple tools.

1. The Microsoft CRM Data Migration Manager.  This comes in both a local/hosted version and a CRM Online version. Don't get these confused, they are not compatible.  Also, I very strongly recommend setting up a virtual machine to install these on, it will save you a lot of heartache in the future, and you can avoid some "gotchas" about how the DMM works on a clean VM.

2. The CRM Bulk Data Export Tool.  This is Arke Systems' updated version of the Bulk Data Export Tool. The changes we made include being able to get GUIDs out of CRM, and not having to set a date limit for how much data you're getting out of CRM.  If you have any trouble with the app, please post the errors, and we can take a look. It's not technically a supported app by us or by MS, but I'll try to help.

So now that we have the tools we need, let's get down to brass tacks.  First things first, extract the information you need about the Account into its own CSV file.  At the minimum, you'll need a Company Name.  Once you have that file, go ahead and upload it to CRM via the Data Migration Manager.  Once that's done, open up the Bulk Data Export Tool. Authenticate to your CRM, and then export the Accounts back out.  Make sure to set in the dropdown that you want the IDs exported too.  That this does is give us the GUID of every Account you just uploaded to CRM.

Below: The Bulk Export Tool.  Important field highlighted in red.

Now that we have those GUIDS, we need to find a way to set those in your Contacts list (or whatever list you need to associate with those Accounts).  Sure, you could just copy and paste those GUIDs next to the appropriate contact, but that would take forever.  What we need is a little Excel magic.  First, you're going to need to understand how to use the OFFSET and MATCH functions in Excel. Say you have an Excel document with two sheets in it (this can also work across documents).  the first one has a list of all companies and the related GUIDs.  The second one has a list of contact names and the companies they are part of.  So on the Contacts sheet, you're going to add two more columns, Match and Account ID.  On the Match column, you're going to write something like this: =MATCH(A2,Sheet1!A:A,0).  What that tells me is that on Sheet1 (where the Company list resides), I want to find the relative position of the Company Name and report a row number back.  On the Account ID column, you'll put something that looks like this: =OFFSET(Sheet1!$B$2,Sheet2!B2-2,0). What that means is that you want Excel to go look on Sheet1 and grab the GUID relative to the Match number you've pulled to Sheet2 (the Contacts sheet).

Below: Sheet2 and Sheet1 examples

So now you should have a list of contacts that also has a list of GUIDs under the heading Account ID.  Save that file as a raw CSV, it's time to go back to the Data Migration Manager.  Start another migration with your contacts, and match up fields like normal until we get to the Account ID. For this one, we're going to do things a little different.  First, select the field in CRM called "Parent Customer".  When you do, it should take you to another page asking you to link up this field with one in Accounts.  That's good, we want that. So select the dropdown that says Account ID and continue on.

Assuming the rest of the migration goes smoothly, you should be able to go into a Contact and see that it has a Parent Customer all set. If you prefer to have the Primary Contact field in Accounts populated instead, just reverse the order of uploads.  Do Contacts first, and then upload Accounts with the Primary Contact ID instead. Speaking of which, that is a limitation of this method.  You will always have one standalone Entity at the beginning (normally Accounts or Contacts).  I have not found a good way around that, yet.

So I hope that helps all of you that have been struggling with a simple, yet reasonably effective way of importing data to CRM on a budget.  Please hit up the comments with suggestions on improving this, or any questions you have about the process!

Categories: CRM
Posted by Wayne Walton on Monday, March 2, 2009 12:09 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Deploying IIS dlls, part 2

Following up on my previous post about copying some CRM Plugin DLLs after a build ( ):

It turns out that the error checking in post-build events isn't reliable (it only checks errorlevel at the end of the script), and apppools don't stop instantly even when told to stop instead of recycle. 

So if my xcopy encounters a "sharing violation" (errorlevel 4) then the post-build event isn't smart enough to notice by default.

Luckily, it's just a bat file, so we can add some checking ourselves.  This is getting more complicated than I would like, but at least I build reliably now.

"sleep" isn't necessary, but it's a useful command to have around.  It comes with Windows 2003 Server Resource Kit: ; restart visual studio after installing the kit.

A note on checking return codes in batch files: Equality checks are actually 'greater than or equal', so you will see people checking if errorlevel eq 1 often.  However, this only catches >= 1 error levels, and the occassional program that returns negative error codes will slip past.  Accordingly, always check "neq 0" instead of "eq 1".  Also, using "SETLOCAL ENABLEDELAYEDEXPANSION" and !ERORRLEVEL! is not strictly necessary in this script, but it's good practice to just always use delayed expansion when checking return values in batch files so that you don't screw up one day when you write an error check inside a loop.

So, hopefully my final iteration of a post-build script that needs to update some IIS dlls:

net pause KeepAliveService 
cscript /nologo "$(ProjectDir)\iis_stop_app_pool.vbs" "CRMAppPool" 
set CRMDIR=C:\Program Files\Microsoft Dynamics CRM 
set loop=0 
set /a loop=%loop%+1 
xcopy "$(TargetPath)" "%CRMDIR%\Server\bin\assembly" /i /d /y 
xcopy "$(TargetDir)$(TargetName).pdb" "%CRMDIR%\Server\bin\assembly" /i /d /y 
cscript /nologo "$(ProjectDir)\iis_start_app_pool.vbs" "CRMAppPool" 
net continue KeepAliveService 
goto FAIL 
sleep 1 
echo "Failed with errorlevel !ERRORLEVEL!" 
exit 1 
echo "OK" 

Edit 3/30/2010: For a 64 bit system, you can get silently redirected to SysWOW64 when a 32 bit process is trying to run something in system32.This causes iisapp.vbs to fail when run as a post build event. In Visual Studio, it shows as an exited with code 1 error. If you manually go to the [windows]\SysWOW64 folder and run iisapp.vbs, you can get an error like:Could not create an instance of the CmdLib object.Please register the Microsoft.CmdLib component.

One solution is to copy the necessary files to the SysWOW64 folder and reregister the dlls:
cd c:\windows\SysWOW64
copy ..\system32\iisapp.vbs .
copy ..\system32\IIsScHlp.wsc .
copy ..\system32\cmdlib.wsc .
regsvr32 cmdlib.wsc
regsvr32 IIsScHlp.wsc


Posted by David Eison on Friday, February 27, 2009 5:23 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Recycling IIS app pools

When developing for Sharepoint or working on CRM DLLs, you need to recycle the IIS app pool a fair bit.


Maybe I’m late to the party and everyone already knows this, but just in case, this utility for resetting iis app pools rocks: 


You can also recycle an app pool in a script with

cscript c:\windows\system32\iisapp.vbs /a "CRMAppPool" /r 

But, for my CRM DLL, I need a post-build event that stops the app pool before I copy a DLL.  I tried simply using iisapp.vbs to recycle, but this failed sometimes because the DLL can still be in use after the restart (I'm not sure if it restarts too fast, or if it due to overlapped recycling).

Based on posts from and , I ended up with the below.

My post-build event:

cscript /nologo "$(ProjectDir)\iis_stop_app_pool.vbs" "CRMAppPool"
set CRMDIR=C:\Program Files\Microsoft Dynamics CRM
xcopy "$(TargetPath)" "%CRMDIR%\Server\bin\assembly" /i /d /y
xcopy "$(TargetDir)$(TargetName).pdb" "%CRMDIR%\Server\bin\assembly" /i /d /y
cscript /nologo "$(ProjectDir)\iis_start_app_pool.vbs" "CRMAppPool"


The stop and start scripts: 


Option Explicit
Dim apool, strComputer, objWMIService, colItems, objItem
apool = WScript.Arguments.Item(0)
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2") 
Set colItems = objWMIService.ExecQuery _
    ("Select * From IIsApplicationPool Where Name = " & _
        "'W3SVC/AppPools/" & apool & "'")
For Each objItem in colItems
  Wscript.Echo "Stopping " & objItem.Name    


Option Explicit
Dim apool, strComputer, objWMIService, colItems, objItem
apool = WScript.Arguments.Item(0)
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2") 
Set colItems = objWMIService.ExecQuery _
    ("Select * From IIsApplicationPool Where Name = " & _
        "'W3SVC/AppPools/" & apool & "'")
For Each objItem in colItems
    Wscript.Echo "Starting " & objItem.Name

Posted by David Eison on Friday, February 27, 2009 1:09 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Useful CRM links

For those of you who are looking for resources to help with CRM issues, or just to keep up on the news of CRM, I wanted to provide a few links.

So I hope that helps anyone looking for solutions and/or community for CRM.  If you are in LinkedIn, there are numerous CRM groups there as well.

Finally, Update Rollup 2 for CRM 4.0 has been released!  Get those patches up and running.

Categories: CRM
Posted by Wayne Walton on Thursday, January 22, 2009 11:30 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Hiding and Changing Left Navigation Items in CRM 4.0 Entity Screens

First off, I want to give a big thank you to Jeremy Winchell for writing up the post that got me started in the right direction for this solution.

For those of you that customize Microsoft Dynamics CRM 4.0, like I do, then likely one of the things you repeatedly run into is clients and users that need to have better names for their actions.  Changing these names on the main navigation page relatively simple, but what about on all the other pages, like Contacts, Accounts, etc.?  These, for whatever reason Microsoft had, aren't removable or changeable.  It's a really painful oversight to have to tell a client that even though you have renamed "Products" to "Hardware", they're going to have to remember that it's still going to be "Products" in a few places.  Hopefully the next version of CRM will have the capability to alter and remove these natively, but until then, we'll have to roll our own.

 Warning, the following actions are not supported or even documented by Microsoft.  Use at your own risk.

Now that the disclaimer is out of the way, let's take a look at the meat of the solution.  First, go to the customization area of the Entity you want to change, and open its form view.  In there, click Form Properties and enable JavaScript for the OnLoad action.  The link above has pictures if you're not sure how to get there.

Now you will need the JavaScript:
document.getElementById("%variableName%").style.display = "none"

So in this line, %variableName% is the variable related to the button on the left-hand nav.  “none” will hide this element entirely.  (Also, make sure if you copy and paste that you don’t end up with retarded Word-style quotes.  That happened to me and I spent 10 minutes trying to find a typo in my code)

If you want to change the display name of a button, then you have a bit more work to do.

Again, the JavaScript:
document.getElementById("%variableName%").innerHTML= "<img src=\"%imageLocation%\" /> %displayName%";

Here, you will see that we’re using innerHTML to actually change the content of that button.  Now you don’t have to have the image code in here, but if you leave it out, then your link won’t have an image anymore, and will just be text.  If you want to keep the image, the best thing I have found is to use the IE Dev Toolbar and then look at that button’s properties (to get the IE Dev toolbar on a popup screen, hit Ctrl+N).  You will see the link to the default image there.  This is going to be different for every CRM install, so I have not included it on the table below. Then just change the Display Name with whatever you want the button to actually say, and you’re set!  Note that the quotes around the image location have to be escaped.

Below is a list of the links, their variable names, and their default Title.  From there, making changes to the left nav of any entity in CRM should be simple.   You will see repeats of some.  The reason for that is because MS was not 100% internally consistent in its naming scheme.  For example, Cases is IDed by both navService and navCases, depending on where you are.  For those, I would either try both, or check on the screen itself.


Link ID Name

Default Title



View Activities

Campaign Activities


View Campaign Activities

Campaign Responses


View Campaign Responses



View Campaigns



View Campaigns



View Cases



View Cases



View Competitors



View Competitors



View Contacts

Contacts Excluded


View Contacts Excluded

Contacts Selected


View Contacts Selected

Contract Lines


View Contract Lines



View Contracts



View Documents

E-mail Messages Created


View E-mail Messages Created

Existing Products


View Existing Products



View History



View general information about this record



View Invoices

Marketing List Members


View Marketing List Members

Marketing Lists


View Marketing Lists

More Addresses


More Addresses



View Opportunities



View Orders

Other Contacts


View Other Contacts

Planning Tasks


View Planning Tasks

Price List Items


View Price List Items



View Products

Quick Campaigns


View QuickCampaigns



View Quotes

Related Campaigns


View Related Campaigns



View Relationships

Sales Literature


View Sales Literature

Sales Literature


View Sales Literature



View Sub-Accounts



View Sub-Contacts



View Substitutes

Target Marketing Lists


View Target Marketing Lists

Target Products


View Target Products



View Workflows

Write-In Products


View Write-In Products


So now you should have all the tools you need to customize the Entity Screens into something useful for your clients and users.  And don't forget, if you break something, you can always just delete the JavaScript and start over.

Posted by Wayne Walton on Tuesday, October 14, 2008 2:30 PM
Permalink | Comments (0) | Post RSSRSS comment feed

The Importance of Your Customer Data Lifecycle

This is a first of a series of articles I will be writing on customer data in business.  I'm starting off with a broad scope, but plan on breaking down into how CRM can help in these situations in future articles.


When you think of companies, what do you think of as their most important asset?  Is it what they produce?  If it the real estate they own?  Perhaps their employees, as so many are wont to claim.  While all of these might be important, none of it matters without customers.  A company’s information on their customers is their lifeline to continued success and profitability.  Without it, they have no reliable way to upsell their returning customers.  They have no way to follow up and make sure their customers’ needs are fulfilled.  Further, loss of customer information can lead to lawsuits and public embarrassment.  All told, the data you have on a customer has a lifecycle.

This lifecycle begins when you acquire a new customer.  Who is responsible for entering a customer’s data?  Does everyone follow established procedure when they enter new information? What is the initial follow-up procedure?  Consistency ensures that all future maintenance and manipulation can be done with a minimum of fuss. This is also a good time to ask questions of your new customers.  Most will appreciate the attention.  As a personal example, I enjoyed a particularly good beer recently, and wrote the maker, Anheuser-Busch asking them to produce more.  A couple weeks later, I got a call from them, wanting to know more.  They spent an hour on the phone with me, picking my brain about what I like.  In the end, they knew a lot about my beer habits, and I felt useful.

The main lifecycle of most customer data is while they are active customers.  This is the part that is most obviously critical to a business.  How are customers being upsold? What market trends can be gleaned from current sales? When they leave, why are customers leaving?  These three questions are closely tied together, and really lead to one determinant question.  Are you fulfilling your customers’ needs? Without the answer to this key problem, a company can never truly thrive.  As an example, Google’s whole business model is built around getting buyers and sellers together as effectively as possible.  Most people think of Google as a search company, but in reality their business is advertising.  Their AdWords (and its counterpart, AdSense) product is designed to create an efficient market where companies can bid on commonly used search terms.  Between this, and the ROI (return on investment) tools they offer to their customers, Google has built one of the most effective systems in the world of connecting company and customer.

Finally, in its end time, customer data must be secured and stored. Is there a data retention policy in place? What security measures are being taken to ensure that sensitive data is not inadvertently released? What is being done to mine this old customer information?  Old data is both a treasure trove and a security hazard. Properly analyzed, old data might reveal former customers that have a need of a new offering you have, or a fixable flaw in why you they are former customers.  Flipside, an embarrassing data leak can lead to a company being in the papers for all the wrong reasons.  Likely the most famous example is when CardSystems released 40 million credit card numbers accidentally.  Charges were even brought against them by the FTC.  This kind of loss could even sink a company.

The lifecycle of customer data is easily the most overlooked process in companies today.  As it is not a physical, tangible object, many tend to undervalue such information, even though it represents the core of what a company does. After all, without anyone to sell to, what would a business do?

Posted by Wayne Walton on Monday, March 17, 2008 2:16 PM
Permalink | Comments (0) | Post RSSRSS comment feed