Sunday, January 30, 2011

Installing CRM on a 2008 web server

I was installing CRM 2011 today on a 2008 web server.  CRM requires the indexing service to be installed (for the help files).  I was unable to figure out how to add this feature through the GUI.  So I used the powershell to get this done:

servermanagercmd -install Resource-Manager
servermanagercmd -install Indexing-Service

Tuesday, January 25, 2011

Registering Plugins against Many to Many relationship changes

I recently needed to register a plugin against the creation and deletion of a many to many relationship (N:N) in CRM 4. I did a little searching and found a couple really good blogs regarding this issue:

Have fun...

Wednesday, January 19, 2011

Problem with CRM 4.0 SSRS report with 2008 R2

I was working away on a custom SSRS report for CRM 4.0 and ran into a strange issue when I ran the report from inside CRM:

The report parameter 'P1' is read-only
and cannot be modified

I found the solution on Microsoft's site.  You have to log into the report server and set any CRM related parameters to 'Hide.'  Really???  Let's get this fixed people...

Error when creating a new organization

I was trying to create a new crm organization the other day and ran into a strange error:

Cannot create a file when that file already exists. 
(Exception from HRESULT: 0x800700B7) 

This left me scratching my head for a while as it's not a very helpful message.  I did a quick inventory of the things I had recently changed on the server and realized that the website that runs the report server was off because I had installed SharePoint on port 80.  I just shutdown the SharePoint website, fired up the SSRS website and tried to re-create the new crm organization.  It worked without a hitch...

Have fun,

C

Sunday, January 16, 2011

Using the CRM API to move users to another Business Unit

Hello Gang,

I recently had to write a piece of code to move users to different business units via the CRM API (v4).  To to move the user to a new business unit API uses a SetBusinessSystemUserRequestmessage.  We ran into a problem with this message.  The SetBusinessSystemUserRequest message needs Security Principal to assign the moving users' records to.  If you want to move the user between business units and retain record ownership you can set the Security Principal to the moving user:

SetBusinessSystemUserRequest sbsur = 
new SetBusinessSystemUserRequest(); sbsur.BusinessId = businessId; SecurityPrincipal sp = new SecurityPrincipal(); sp.PrincipalId = movingUserId; sp.Type = SecurityPrincipalType.User; sbsur.ReassignPrincipal = sp; sbsur.UserId = movingUserId;

This code will not work.  Each entity in CRM has a owningbusinessunit column in its base table.  When executing this code the owningbusinessunit column is not updated.  To work around this bug.  Do the following:

SetBusinessSystemUserRequest sbsur = 
new SetBusinessSystemUserRequest(); sbsur.BusinessId = businessId; SecurityPrincipal sp = new SecurityPrincipal(); sp.PrincipalId = Guid.Empty; sbsur.ReassignPrincipal = sp; sbsur.UserId = movingUserId;

Kind of silly if you ask me...  But it works.

Happy coding!

Friday, January 14, 2011

IIS and missing line numbers from stack traces

Hello...

So I ran into an interesting problem today.  I was trying to get line numbers to show up in stack traces.  I made sure that I compiled the code to generate .pdb file and also made sure that the code was compiled without optimization.  I then had some code devide by zero to generate an error.  The line numbers didn't get printed out until I set the IIS authentication to be only 'Windows Authentication' (logged in as a domain admin).  So it looks like there are some permissions needed to get the line numbers in a stack trace.  When I get more time I dig into this more.... 

Happy coding!