June 29, 2007

Adding a reference to external .js file in your form

This code creates a new script element and inserts it into the head of the HTML document that defines the form:

st = document.createElement("<script src='http://<server>/<site>/<filename>.js' language='JavaScript'>");
h = document.getElementsByTagName('head');

Using this method to reference an external script in a production environment is unsupported because it introduces several areas for concern:

  • Transportability
  • External Site
  • Doesn't work offline
  • Future Upgrade issues
  • Possible Timing issues
  • Poor programming practice

June 27, 2007

How to set user's home page?

I got a request that all users of CRM must have their first page set to announcements.

Of course I could write a mail to all users requesting them to change their page in settings page to announcements, but this is a no no way.

So I searched the SQL database and found a user settings table in _MSCRM database. Just set the HomepageSubarea of the table UserSettingsBase to the value 'nav_news'.

So if you want to set announcements as a home page for all users just run the query:

UPDATE [UserSettingsBase] SET [HomepageSubarea] = 'nav_news', [HomepageArea] = 'Home'

Although it works in my installation, this is not a supported change, so you are doing it at your own risk. Do backup the database before messing with it. Just in case.

Renaming a (Customizable) Entity

Just changing the entity display name is not enough. There are more places where the name must be changed to fulfill customer's experience.

Areas that Need to be Changed:

  • Entity Name
  • Entity Form Labels
  • Entity View Names
  • Entity Attribute Display Names
  • System Messages
  • On-line Help Content
  • Reports

Some Areas Cannot be Changed

  • Platform error messages and messages that are displayed in Trace or the Event Log. These messages cannot be edited.
  • Strings added to the ISV configuration file.
  • User Manager component of the Microsoft CRM Deployment
    Manager tool. These strings cannot be edited.
  • Environment Diagnostics Wizard. These strings cannot be edited.


Basically changing the entity's name is a seven step process:

Step 1: Change Entity Name.
In the Entity Definition section, change the Name and Plural Name
to the new name.

Step 2: Edit Entity Forms and Views to Display the New Entity
Change Form Labels and View Names.

Step 3: Change Attribute Display Names for the Entity that is
Use Customize Entities tool to change attribute display names associated with renamed entity. This will update any other parts of the application that uses these attributes, such as View headings.

Step 4: Customize Messages and Strings Associated with
Entity that is Renamed.
Use the Customize Entities tool to customize messages and strings associated with the renamed entity.

Step 5: Publish Changes.
The Name of the entity in the Navigation Pane may not respond to the changes. The information in the SiteMap is cached on the browser. Users may need to press F5 to see the changes.

Step 6: Edit affected help Content to Display the New Entity
Manually edit entity names in help content and re-deploy the help content.

Step 7: Modify Affected Reports to Display the New Entity
Manually modify entity names in reports and re-deploy the modified reports.

June 26, 2007

Yay! I passed the exam!

Today I sucessfully passed the Microsoft exam called CRM 3.0 Applications.

The exam number is: CRM-30-423

June 4, 2007

How to debug callouts?

First, here are two points, that I would like to express:

  1. I want to debug callouts directly and not with log files.
  2. .NET 2.0 rulez

What now? Callouts use .NET 1.1 and just forget about remote debugging or something like that.

Why not create callouts that use some web service? If you have it installed on the same machine, then you can easily use impersonation etc.

So here's how I do it: I develop a web service that uses CRM web services, test it with normal win32 application and then just insert those 2 lines of code in callouts that call my web service. Use of dynamic entities is very very strongly recommended. You can serialize and deserialize them easily and if the structure of CRM entity model changes, you don't have to worry. Even callouts can have config files.

Web service is running in .NET 2.0 environment and I can debug it freely!

This is how I do it. What about you?