Thursday, December 17, 2009

"Service Unavailable" message in CRM 4.0

If you are running Windows 2003 server with a CRM Installation and you get the "Service Unavailable" message, check the application pool for CRM in IIS.

If it's stopped, start it again, and try going to the CRM web page again. If the CRM application pool stops again, it's likely that you've just applied patch KB973917, try removing this patch from the server, reboot, this should fix the problem.

Cheers

Matt

Thursday, December 3, 2009

LINQ to SQL Entity Base - Version 1.2 Beta

Hi everyone,

I've released a beta of the LINQ 2 SQL Entity Base - included in it is the following changes since the V1.1 final:

  • Bug Fix: If the entity's state is "New", LINQ to SQL Tries to attach an FK references as "New" as well - even though this was unintended. Fixed it so it does not try and insert FK referenced entities when adding a new object. Thanks Mark & Stephan for finding/fixing the issue
  • Bug Fix: If the onModifyKeepOriginal parameter on SetAsChangeTrackingRoot() is set to true and an object is detached from a collection (i.e. x.remove(y)), the object was not being attached properly to the data context when SynchroniseWithDataContext() was called, causing an error to be thrown. Thanks Yaki for finding the issue!
  • Bug Fix: When EntityState == CanceNew, don't change to EntityState == Deleted when SetAsDeleteOnSubmit is called.
  • Feature: Added ShallowCompare Method, which compares the properties of two entities and returns true if all the properties match (compare LINQ to SQL ColumnAttribute properties only).
  • Feature: If the onModifyKeepOriginal parameter on SetAsChangeTrackingRoot() is set to true, and an object is modified (i.e. EntityState == Modified) and then modified again in a way which set's it back to be the same as property values as it's original state, the entity will now have it's EntityState set to back Original (instead of remaining as EntityState == "Modified").

It can be downloaded here:

http://linq2sqleb.codeplex.com

Cheers

Matt.

Tuesday, October 27, 2009

Address Attribute Length Fun in CRM 4.0

When you extend the length of Address attribute on a Contact or Account, this does not actually extend the length of the attribute in the database auto-magically only the length of the data that can be entered on the UI.

The address details are not stored agains the customer, they are stored in a seperate entity called "Address".

In order to extend the address you need to update the "Address" attribute too.

See this KB for more info:

http://support.microsoft.com/kb/973029

Data Migration Manager Troubles with CRM 4.0

Today I spent quite a lot of time trying to figure out why the data migration manager would not let me sign in.

I'd just installed Rollup Pack 7, and noticed that there was no Data Migration Manager Update available in Rollup Pack 7, so I installed Rollup Pack 6's version of this update.

Everytime I tried to login, it would complain that ...

"You must have the System Administrator Security Role to use this Tool".

I was puzzled, I checked multiple times to make sure that the user I put in during the install was correct, I searched the web - but this error had not be reported anywhere by anyone.

Finally I decided to remove the Rollup Pack 6 update (only the update) for the Data Migration Manager, and to my surprise this worked! Infact I was even more surprised to find that it did not complain that there were updates available for it (which it usually does...).

Anyway, I re-installed the Data Migration Manager Rollup 6 Update and it now works.

So the fix is to Re-install if you get this error message.

[UPDATE] Came into work this morning, and a member of my team had exactly the same problem on a completely different server, Wonder if there's a Data Migration Manager Rollup-7 that hasn't been upload to the MS Download Site yet?

[UPDATE2] There's a Rollup Pack 7 installer for the Data Migration Manager Now, however haven't tried it yet to see if it works personally, but apparently it does.

Friday, September 4, 2009

Default Organization For User is incorrect in CRM 4.0

Occasionally you come across the situation where the default organization has been changed and some of the users are still mapped with the default to the old database. This is quite annoying and can actually point your custom aspx pages to the wrong organization.

To fix this issue, I've written a SQL Server script which basically does the following:

  1. Finds the specified organization in the MSCRM_CONFIG database (the one that you want to be the default)
  2. Finds the specified user ( which has the incorrect default database ) in the organization database which is intended to be the default (Based on '<domain>\<username>')
  3. Finds the user details in the MSCRM_CONFIG database from the specified user found in the organization database
  4. Updates the user record in the MSCRM_CONFIG database to have the specified default organization set.

Notes on running the script:

  1. Backup your MSCRM_CONFIG database first! This is unsupported by Microsoft and Me!
  2. Set the Domain\Username & Organization Name in the section titled 'PLEASE FILL IN THE FOLLOWING'
    1. The @UserDomainName is the same as found the DomainName box in the User CRM Screen
    2. The @DefaultOrganization should be the name of the organization as shown in the deployment manager
  3. The script is designed to be executed in the context of the organization database which you want to be the default for the specified user, please make sure that this is set to the correct database before running
    1. i.e. you can do this by using the 'Use <databasename>' command in SQL first before executing the script.
  4. UPDATE: You may need to restart IIS in order for the change to take place.





DECLARE @DefaultOrganization AS VARCHAR (100);

DECLARE @DefaultOrganizationId AS VARCHAR (100);

DECLARE @UserDomainName AS VARCHAR (100);

DECLARE @CRMUserId AS VARCHAR (100);

DECLARE @UserId AS VARCHAR (100);

SET @UserDomainName = '<domain>\<username>';

SET @DefaultOrganization = '<organizationname>';

SELECT @DefaultOrganizationId = id
FROM MSCRM_CONFIG..organization
WHERE UniqueName = @DefaultOrganization;

IF @DefaultOrganizationId IS NOT NULL
BEGIN
SELECT @CRMUserId = systemuserid
FROM systemuserbase
WHERE domainname = @UserDomainName;
IF @CRMUserId IS NOT NULL
BEGIN
SELECT @UserId = userid
FROM MSCRM_CONFIG..systemuserorganizations
WHERE crmuserid = @CRMUserId;
IF @UserId IS NOT NULL
BEGIN
SELECT 'BEFORE', *
FROM MSCRM_CONFIG..systemuser
WHERE id = @UserId;
UPDATE MSCRM_CONFIG..systemuser
SET defaultorganizationid = @DefaultOrganizationId
WHERE id = @UserId;
SELECT 'AFTER', *
FROM MSCRM_CONFIG..systemuser
WHERE id = @UserId;
END
ELSE
BEGIN
PRINT 'The User was Not Found in the Organization - Please check';
END
END
ELSE
BEGIN
PRINT 'The User was Not Found in CRM - Please check';
END
END
ELSE
BEGIN
PRINT 'Default Organization Not Found - Please check';
END

Tuesday, September 1, 2009

Run as Different User in Windows 7

In windows XP, when you wanted to run as a different user you could by right-clicking and selecting "Run As", in Windows Vista this was missing – although you could use the RunAs.exe in command line to kick off an application as a different user – it was really annoying and painful to do.

Now in Windows 7, Run As is back!

To run as a different user, simply hold down shift and right click on an icon to get the "Run as different User" option.

Very useful in MS CRM for testing our roles for different user.

Matt.


 

Friday, August 28, 2009

Access denied to something? – try changing your password


 

One thing that I've found time and time again with Windows authentication is that even though you have access to something and your password is not expired – you may still received the "access denied" type response from different applications/services.

At first you think it's some kind of issue with permissions, you try rebooting etc... But nothing works.

In these circumstances, if you have noticed that you are being reminded to change your password when you log onto the windows server/workstation – then changing your password may be the key!

It seems that although technically your account on the domain hasn't expired - because it's due to expire this sometimes seems to be interpreted as the same thing (i.e. it considers your account expired). Perhaps the underlying integrated security authentication that goes on behind the scenes doesn't always deal with this situation properly, and just rejects by default.

Anyway, try changing your password and see if that helps!

Matt.

Tuesday, July 14, 2009

Version 1.1 Final of LINQ to SQL Entity Base Released

Hi everyone,

I've released the latest version of the LINQ to SQL Entity Base. If you are unfamiliar with it, it allows you to have change tracking without having to have the DataContext object within scope.

Here's the changes since Version 1.0

Improvement: Implemented caching for reflected properties which should significantly speed up creation of entity instances. Thanks Johannes!

Improvement: If you delete an entity while it is in the new state (and therefore has not been submitted to the database yet), the entity will now be removed from the scope of the entity tree during the call SyncronisationWithDataContext(), and as there are no references to the entity anymore it will be garbage collected. Before this change, the object would still hang around.

Bug Fix: Issue where setting a value FK value via object reference did not result in entity being flagged as modified unless you modified another property on that entity as well.


Anyway, head on over to codeplex to check it out.

Cheers

Matt.

Saturday, July 4, 2009

Javascript showModalDialog() - Not impressed

Recently I was working on an ASP.Net page to put in an IFRAME for Microsoft CRM. I had a requirement to choose a CRM systemuser from a list, and so naturally I went looking for a way to do this.

I stumbled across showModalDialog() and thought it was the way to go as it offered a Modal Dialog window which I could put to any URL and also could return any result I wanted back to the calling window really simply.

So, everything seemed to work great, but as it turns out, it IE 8 seems to cache the Dialog window so everytime that you start it up it would show the very first window that you had that ever used it (not just for that session, but the very first time you used the window with that URL). This was really odd, I tried several methods for stopping the caching but none of them seemed to work - even changing the URL to be unique every time didn't even stop it!

At the end of the day I gave up after finding out so many other people were having problems with it, and that it's functionality and become "flakey-er" as new revisions of IE were released (I also discovered that it's an IE only feature).

I ended up just re-arranging my base page (the one that i put in the IFRAME) to include the some functionality.

From now on I'll be avoiding the showModalDialog() - as I wouldn't be surprised if it doesn't work at all in the next version of IE. And although I ended up not using any type of Modal in this instance, I did find examples of how it's possible to do it with standard (non IE specific) code.

Lesson Learnt!

Saturday, April 25, 2009

Project your class attributes into a data table.

A friend of mine has written a small tool which allows you to project attributes of your classes into a data table, which you can then use for data binding or reporting. The main reason for doing such a thing is to help out with sorting without having to re-bind the data between sorts.

If your in need of such a thing, please follow this link:

http://code.google.com/p/modelshredder/

Tuesday, March 24, 2009

CRM 4.0 Many to Many Importer Tool

Hi everyone,

I was surprised there didn't seem to be any easy way to import N-N database relationship data into the database, and as you can't do it yourself via T-SQL inserts I have written a tool to import many to many relationship data (N – N) into the database – which may be helpful for someone out there.

The project has been published on Codeplex Here along with the instructions on how to use it.

Cheers

Matt.

Monday, February 23, 2009

CRM 4.0 Picklist Generator Tool

Hi everyone,

To generate the picklist options in the application I work on, i'm always using the CRM 4.0 Picklist Item generator created by http://marioraunig.blogspot.com/, which I think is a great tool - quick and easy!

Often however I find that I need a few more features and so i've written my own utility for generating these codes, which over time I plan on adding more features too.

Find it here:

http://www.codeplex.com/CRMPicklistGenerator



For the moment, I've added the following features which I've found useful....

1. You can specify which number to use as the picklist value.
2. Options are specified as

[value], [description]
OR
[value],"[description]"

where [value] is the underlying value (int) and [description] is the pick list option description that's shown to the user.

3. You can sort by the description (deals with comma's in description as well).
4. You can specify which language code you want the list to use.
5. Allows comma's in descriptions and removes quotes

In order to use it,

1. Generate the option list
2. Open up your customization.xml file in Notepad or Visual Studio
3. Find the appropriate section of the xml file
4. Paste the generated option list into the xml file
5. Re-import the customization.xml file.

Anyway, hope it's handy for someone out there...

Cheers

Matt.

Monday, January 19, 2009

Update Rollup 2 for Microsoft Dynamics CRM 4.0

It looks like Microsoft have release the second rollup package for Microsoft CRM 4.0 in only a matter of months! 

I only hope that CRM 5.0 comes sooner than expected too :)

Find the information here and the download for the rollup package here