Knowledge found and lost while working with Microsoft Dynamics CRM
RSS icon Home icon
  • Custom Messages and Moving Customizations Between Organizations

    Posted on March 28th, 2009 Mitch Milam Print Print No comments

    This week I was working with a customer who was using CRM 4.0 and had a fairly advanced set of customizations dating all the way back to CRM 3.0.

    I wanted to do some prototyping on an idea I had so I created a second Organization on the development server with the idea of exporting customizations from the main development organization into the new test organization.  That was the plan anyway, but it didn’t work out like that.

    Here is one of the errors I received when performing the import:

    Failure: opportunity: The custom message must contain the same number of substitution parameters as the system message. Enter a message with the correct number of substitution parameters.

    Wow, that’s nice.  Now since I am a developer, I’m pretty sure I know what it’s talking about, and sure enough, I think I found the culprit:

    image

    Notice that the Default Display String has ‘{0}’ in it?  That’s the “substitutable parameter.”  Notice that the Custom Display String doesn’t have it?

     

    What is a Substitutable Parameter?

    Within the .NET programming language C#, you have the ability to leave a “placeholder” or “substitutable parameter” inside of a string.  You later replace that parameter with a real value using the method String.Format.  The parameters start with zero (0) and increase in numeric value from there. 

    So, the command:

    String.Format(“this is a {0}.”, “test”);

    would produce the result:

    this is a test.

     

    So what went wrong?

    Well, there are actually two issues:

    1. The developer who created this customization didn’t make the Custom Display String function exactly the same the Default Display String.  This would have possibly caused an error at some point in the future.
    2. It appears that the upgrade process from CRM 3.0 to 4.0 did not perform any such checks while the import process does.  This is why the import of the Opportunity Entity failed.

     

    How do you fix it?

    There are two ways:

    1. Delete the customized message string.
    2. Correct the issue with the substitutable parameter not existing in the custom message string.

     

    Conclusion

    Unfortunately, it is quite common to see small issues like this when attempting to move an upgraded CRM system to a fresh install.  There are many issues corrected by hotfixes and added the the various hotfix rollups, but other issues will require you correct the problem manually.

    Customization, Dynamics CRM
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
    527 views

    Leave a reply