CRM 2011 Kerberos Troubleshooting - Report Wizard FetchXml Related Issue

Hi all,

Recently one of our clients had issue when running reports created through the report wizard. After some investigations, it turned out that the FetchXMLDataSource is having some connection issue with an error log recorded something like: A call to SSPI failed, see inner exception.

This is surely a kerberos authentication issue. After a few good hours reading documentations on how to set up proper kerberos for CRM 2011, I managed to get all working nicely. I summarised all what I've done so that it may help you down the track:


  1. Check the CRMAppPool service account whether you are using NetworkService or a domain account. The best practice is to use custom domain account (separate from your CRM admin account as well). In my case I have something like domain\CRM2011APP. If you set this up during installation it should at least be in the PrivUserGroup and PrivSqlServerGroup as well.

  2. Open your AD manager and check if that account has kerberos delegation enabled (On delegation tab). 

  3. On your IIS Manager (IIS 7/7.5), click your Microsoft Dynamics CRM website -> Authentication -> Windows Authentication -> Advanced settings. Make sure Kernel mode is ticked. Also check the Providers and make sure you have Negotiate and NTLM (in this order).

  4. Set the SPN to enable token delegation for the account to the CRM server. Let's say your CRM application server url is http://mycrm.domain.com:5555, then open your command prompt and enter in:
    • setspn -a http/mycrm domain\CRM2011APP
    • setspn -a http/mycrm.domain.com domain\CRM2011APP

  5. (From Microsoft KB2590774) Open IIS Manager. Expand the server and then select Sites. Then select the Microsoft CRM website. Under Management, select Configuration Editor. In the From: section above the properties select "ApplicationHost.config  For the "Section:" location, select system.webServer > security > authentication > windowsAuthentication. In the properties page, set useAppPoolCredentials to True, then select Apply. 
Do iisreset afterwards and try opening CRM, Outlook for CRM and the reports. It should work fine now.

P.S: Only the system.webserver windows authentication should have the useAppPoolCredentials to True. Leave the Microsoft Dynamics CRM windows authentication alone.

HTH,
Andreas  

Knockout and SharePoint - Simple Example

Hi All,

As you all know, client side technology is powerful and I am a fan of it. Apart from being fast and no postback is required, it is relatively easy to develop compared to hefty server side code.

However you should keep in mind that your code can be easily tracked and downloaded so if you have sensitive information and logic that needs to be secured then you need to use server side code :) You can do hybrid application though and that is probably the best way to go.

In this example I will show you how easy to get the data out of SharePoint list and display it with a little user interactivity. This web part consists of a user control and it basically displays a land mass comparison in boxes. Most of the times people do not realize how big WA is in comparison to their own country and when they come here they find out that they need 1-2 days to get to the other region.

End result will look like this:



We will be using:
1. jQuery + Knockout 2.1.0 for the awesomeness
2. SPServices to get the data from SharePoint list

The Html:


The Javascript:


That's it! How simple that is :)
P.S: I avoid using drawing plugin etc. because for these simple boxes we can just use square div tags ;)

Hope this helps,
Andreas

LINQ Grouping through SelectMany - Powerful!

This is the first time I use this feature and I love it very much!

What this feature does is that it flattens your object in relation to your defined selected child object.

So for example, if I have a list of Item object and that object has a List of Category (imagine Item has N:N relationship to Category) and I want to be able to group it based on the Category and display it in such a way so it looks like this:

Category 1
  • Item 1
  • Item 2
  • Item 3
Category 2
  • Item 2
  • Item 4
and so on..

It is easy to get that structure using LINQ!


That's all you need to do! ^_^ Hope this helps, Andreas

jsRender for complex display rule

Hello Everyone,

So it comes to a point where I have a set of data in front of me and I want to render those data in a quick and easy way. I don't like rendering html through code behind because it is just cumbersome and hard to maintain. Also, it is not that simple to display these data because there needs to be some logic when rendering each record.

This is where I thought that jsRender would be the perfect thing to use! I have used jQuery template before and  I found it quite useful but they did not continue that project. jsRender is still active in development and it is proved to be much powerful and faster (as it's claimed to be) and fortunately it is very easy to use as well.

To cut things short, the sample data looks like this:
Entity: CourseOutline
Attribute:

  • PathwayId (each CourseOutline can have more than 1 pathway)
  • PathwayLineNo (1-5)
  • EntryPoint (e.g. Year 12)
  • Duration (duration of the Course)
  • Product (this is the Course Product entity with Product Name and Product Number attributes - only 1 product per PathwayLineNo)
  • IsFurtherStudy (shown in different color)
The end product looks like this:



In the code behind it is pretty simple. You just need to group the CourseOutlines by PathwayId, then serialize it to JSON format and assign it to the public property of the page or in my case - usercontrol:




Now on the design page, just get that content and then parse it to become JavaScript Object. Then use jsRender template to render the display and display it in the div container. Code looks like this:
jsRender Template

JavaScript:


Look how easy it is! The beauty is that you don't have to compile your code every time you make UI changes (if you render it in code).

You just need to modify your design page and it will be reflected straight away. It is very fast in terms of performance and you can style your output easily as well.

 For more information on jsRender visit http://borismoore.github.com/jsrender/demos/index.html. I hope it keeps getting better and better to accommodate more complex scenarios :) Hope this helps, Andreas

Music Website New Look! (HTML5 & jQuery)

Hello All,

I am excited to say that my music website http://pianoismyfriend.com has been refurbished and gone live! :)



I built the website by myself and it was a really good personal project and it allows me to explore all different kind of tools and technology out there. It surprised me how we can leverage variety of existing services people have to offer without reinventing the wheels these days.

Some technical information about the new PianoIsMyFriend website:
  • LightCMS is used as the hosting and the content management provider. I moved away from WordPress because of the maintenance effort comparison and the different goal that I wanted to achieve. My website should be really simple with minimal plugins. I found it hard keeping up-to-date with WordPress versions and updating my plugins that break after updating my WordPress. 

    With LightCMS I was able to get my website up within a week and focus more into my content and   how it fits together. It provides SEO support as well and the CMS is really easy to use for simple website. The only downside is the pricing - I pay $20/ month at the moment compared to the $5 for WordPress previously.
  • HTML5 with jQuery - that's all I used for my website. With the new HTML5 tags including the audio tag, a few jQuery plugins to provide animation and other functionality, it did not take very long to create compelling and attractive look for my website. I used FancyBox with the idea that my visitor should be able to keep listening to my song on the homepage when traversing to different pages. Those pages are automatically opened inside the FancyBox iframe when opened through the homepage. However when going to specific URL like http://pianoismyfriend.com/albums, you can see that it is not an orphaned page because it still has the header, navigation and footer for SEO purposes.

  • E-Junkie is used for their easy 'digital' e-commerce service. It provides digital download with robust management interface. They give the anchor tags for each product you sell to integrate to your website. (as shown above). LightCMS has not provide support for digital download but I was glad to find other alternative that is easy to use and configure.
  • AddThis is used for integrating social media buttons such as Facebook Like and Tweet button. Again, very easy to use and you can integrate with Google Analytics if you want. I just needed to paste the code from their website and modify the Facebook Open Graph meta tags to set the correct thumbnail and information when someone clicking the Like button.

I hope my experience can help you some time down the track if you intend to build simple websites for yourself or your clients. Keep in mind that LightCMS does not allow you to put custom code in so you cannot do extensive programming in that regards. Workarounds are to host that somewhere else and show it via iframe or put it in sub-domain of your website.

Take care and Enjoy!
Andreas

JQuery & Knockout - A Simple Example


Hi All,

I have been assigned to do some client side stuff. In this case, we have some FAQ contents in CRM back-end and I want to  grab those content and display it in a user control.

End result will look like this:

We extensively use Knockout.js and jQuery in terms of displaying simple content. The advantage of this is that it renders much faster than using server controls. To grab the data we can use POST request to get JSON from the asmx webservice.

Here is an example of displaying FAQCategory. Note that:
1. UPDATE - updated to knockout 2.1.0 . This will use native templating.
2. Grouping is achieved by creating pivot 'associative' array object :)
3. Notice multiple synchronous request? This is because the webservice is using RetrieveMultiple request (CRM 4.0) thus I need to grab attribute from related entity. Then I append the attributes to my result object. (can use FetchXML but more cumbersome in terms of parsing + slower than QueryExpression. Also, you can use jQuery Ajax function as well if you wish to :))
4. It is displayed using collapsible behavior of jQuery :)


Template:




Hope this helps,

Andreas

New Songs - Blooming Or Withering Flower

Which one suits your mood? :)

Enjoy,

Andreas

CRM 2011 LINQ Left Join Through Entity Reference

Let's say we have a custom lookup field new_accountid on our phonecall activity (don't ask me why I don't just use from/to field :)) and that field is NOT a required field.

We want to get the account number using LINQ in our code somehow.

This is the way to do it. The trick is that we have to check whether the new_accountid is null and combine those records with the ones that are null.

Hope this helps, Andreas

CRM 2011 Get OptionSetValue Value through Label

Sometimes we want to be able to get the OptionSetValue value from the label itself. One way is to use the metadata request and loop through it but this is a cumbersome way.

The easier way is to put those OptionSetValue data into an enum like this:


We use Description Attribute for the Label so that it supports string format.

Then we use this helper method:


And there you go. You can easily get the value like this:



Hope this helps,
Andreas

Happy New Year 2012!

Happy New Year everyone!



May this year bring you good things and happiness!

Take care,
Andreas