Tuesday, December 29, 2009

SPN Kerberos CRM 4.0 - Again

Another pain in the neck


In Microsoft Dynamics CRM 4.0 you might need to access the sql filtered views from a custom application. Using the webservices can be to slow in complex queries. So having a custom form using a sql connection with SSPI might be the answer.
BUT though your custom pages are placed inside the ISV folder of the CRM application, and you are using the appropriate security configurations for the sql connection - and you application is actually working outside the crm application (ie when you debug using the build in cassinni webserver in VS2008) - it might concider you being anonymous.
This is due to delegation using kerberos for the ServiceAccount that is running the SQL Service for the SQL instance of the CRM Databases.


In order to configure it correctly using the setspn tool from MS, it has been a hassle to me. Try and set it up - Try to see if it works! No error messages, no directions on what might be wrong.


A tool has been developed by Brian Murphy Booth, Escalation Support Engineer at MS Support. The tool can be downloaded here.
To save you from some of the troubles i discovered, place the in a new virtual directory in the root of the webserver.


As for clustered servers, you need to address that when you add a new back-end server.

Monday, December 7, 2009

Workflows don't run - Updated to Rollup7 to make it work again

Well, an installation with no asyncservice running, though it is running(!)


Here in start December I am working on an installation made in February 2009. Created som entities, changed some attributes, adding relationshipsand modifying isv.config and sitemap. So far so good.
Then implemented some simple workflows including some CustomWorkflow Activities. Didn't run as intended. Just waiting statement in progress status.
Tried a simple workflow just updating an attribute when executed. Didn't run. Just waiting.
Looked at systemjobs and noticied that a duplicate job was paused since June.....
But no errors in eventlog.


Installed the rollup7 .....
And everything worked.


Well, i must say that 4.0 is becoming more and more stable. With rollup7 a lot of bugs are fixed and services runs more solid.


So if you haven't updated the server to rollup7 you might want to do that if you experience problems.
THEN AGAIN- Concider twice before doing this. There are someissues with the clients. In Citrix environments users may give that the reason, but I see it on windows 7 with Office2007. CRMClient stopsand you have to close down and open Outlook a couple of times to get all services and the add-in running again.

Monday, November 30, 2009

Can't publish entities in CRM 4.0?

I have been frustrated that from time to time the form, view and entity xml har caused some sort of inconsistency in an instance of an organization nin CRM 4.0.

A colleegue of mine followed this blog post and solved the issue. This will save us a lot of time in future trouble shootings. Post is found at http://blogs.salentica.com/direland/2009/04/16/a-hitchhikers-guide-to-transporting-schemas/

In our case the reasons to this issue were too many cook's. So at some point somebody changed the schema and somebody else (or the same person) imported a partial set of customizations. And schema did not match the form xml. A field on form had an emty string reffering to a non existing attribute on a related attribute.
The blog post was followed step by step and solved the issue.

As a result of this knowledge the future procedures in our company is to have a full backup of databases restored into a new database at the sql server hosting crm databases. Then creating a new organization by importing an organization instead of first creating and then make a full import of cust's will prevent this issue if we keep the newly created organization as the master organization and only deploy from master to live.....

Hope this post  will make the issue and the resolution more visible to other fellow customizers in the future.

Tuesday, November 3, 2009

Microsoft Windows 7 - Awesome!

XP works ok regarding performance. Vista is sensitive to resources.
But Windows 7 is working great. I use an "old" laptop - IBM ThinkPad Z60m.
Vista gave the laptop a hard time due to the missing dualcore processor and lack of graphic and memory RAM.
Windows 7 is working even better than XP.
So now my configuration with Office2007, BPOS Microsoft Online Sign in application, Visual Studio 2008, SQL express edition works like a charm.
No breakdown, restarts, idle processes that takes up cpu or memory......


It is allmost as solid as SnowLeppard.
So maybe Microsoft is really becomming a large world wide enterprice software company with the intention and capability to provide a solid framework for applications, servers and operating systems.


I have been very sceptic about Windows 7. But:
They really made it this time.
At last!

Thursday, October 8, 2009

Make your code on forms adaptable for colleagues ...(And your self)

A lot of samples on scripting is found when you google (or bing) for a specific function. When implementing scripts other fellow developers has written might be hard for other colleagues to adapt and find the full function for, unless you comment and structure your code. Lots of MVP's has samples like this one from Donna Edwards, (see blog here). People like Donna is truely invaluable to the Microsoft Dynamics CRM communities and i have the deepest respect for the effort and time they put in sharing experiences and advising fellow colleagues.

Well, when I build up a set of functionality to an entity, the scripts on form are gathered in the OnLoad event of the form. By declaring the functions here, I get the full picture of all the functions on the form. And I might even reuse some bits and parts and have less code by using parameters when I call the functions.

The sample from Donna Edwards is pretty straight forward – Calculations of fields on the form. Calculations are done from the OnChange events on the form fields.

I would like to rewrite the code like this:

  • Create the two custom attributes that you need by going to Settings, Customization, Customize Entities, open the Opportunity Entity, select Attributes, create two new money attributes, and save the changes. Just like Donna Edwards.

  • Open the Opportunity form and add the two fields to the form.
    Double-click (Open) the Est. Booking field (estimatedvalue) on the form and add the following line of script to the OnChange event of the field:
    CalculateEstimatedValue();

  • Open the Total_Discount field on the form and add the same script to the OnChange event of the field:
    CalculateEstimatedValue();

  • Open the Total_Estimated_Value field on the form and add the following script to the OnChange event of the field:
    CalculateEstimatedValue();

  • Open the OnLoad event of the form and add the following script:
    /*BEGIN Calculate totalestimated value from fields
    EstimatedValue and TotalDiscount OnChange events
    Author: KEYZONE\bjj
    Date: 09102009*/
    CalculateEstimatedValue = function()
    {
    var _estimatedvalue = crmForm.all.estimatedvalue.DataValue ;
    var _totaldiscount = crmForm.all.Total_Discount.DataValue ;
    CrmForm.all.Total_Estimated_Value.DataValue = _estimatedvalue - _totaldiscount ;
    }
    //END Calculate totalestimated value


So here we get all relevant functions located in 1 place: The Onload Event of the form.
And can easily look through the functions and make changes if we need to.
Samples is simple and need some validation of the values for the fields.

NB! If you need a function from the OnLoad event to be run OnLoad (!) you would have to place the function itself before the call to the function.

TIP: To look through all fields trying to find calls from OnChange events is a hazel if you have a Form with many fields on it. You could download the customizations in a file and look through code for each form searching for “[CDATA”. But a tool to sort of document the scripts on forms in excel, can be found at
this link. And that saves me a lot of time, when I want to document customizations or simple need an overview.

For more complex functions that includes webservicecalls it comes in handy, as the webservice call is a lot of lines whether you are retrieving, updating, deleting or creating records, due to the query you have to build up and the iteration through the nodes in the response you get as result from the query.
I will bring some future posts on this issue.
Setting up parameters in the code makes it easy to reuse 1 function for all webservice calls on a specific form.

AGAIN if we want to have a global script because we use the same code on many entities, Adi Katz and others have described how to achieve that. Fully unsupported but very practical.


Saturday, June 6, 2009

Thought that crossed my mind when i get: Either the file could not be uploaded, or this is not a valid Customization file

From time to time i have experienced that importing customizations from one Microsoft Dynamics CRM 4.0 environment to another like from live to development, might cause problems.
For a long time i have been convinced that the issue were caused by missing RoolUps, moving accross native language for CRM installation.
Now, all blogposts i have found on this issue has different approaches to solving the issue. Some has success by increasing filesizelimit in web.config. Others clean up attributes that with no reasonable explanation are missing in schema but still represented on form objects or in views throughout the application. Others again faces oconflict between versions of Rollups.
Latest i read
this thread.

Well, now i am convinced that the issue is far more simple than that.

Removing any tags from exported xml file regarding custom entities that define any custom icons make all my previous attempts on different organizations work!


So xml file is just a noline textstring seperated with tags. could it be that that string is missread by the parser on import, and that the mistake is that it is limited by the lenght of some types of tags?

Hope that this will be solved in a future roolup for Microsoft Dynamics CRM 4.0.