harbars reminds us of the “hidden” costs of sharepoint in the enterprise

You are deploying SharePoint into the Enterprise, so make sure you treat it as an enterprise application. Spence has posted on the ‘hidden’ costs of SharePoint in the Enterprise. But only hidden if you don’t treat it seriously.

And if you get a chance to corner Spence at a SharePoint event in 2009, ask him if Microsoft will be any further forward in giving us a single vendor solution to the issues he raises.

I was in Barcelona for a week in November

I promised I would do a bit of a catch up, so these posts may come out in a bit of a random order.

First notable thing was a trip abroad by myself. I’ve had a bit of a phobia about going abroad – not fancying the challenge of a foreign language for a time of relaxation.

The chance came up to go to a Microsoft Conference in Barcelona – Tech Ed EMEA 2008 Developers, which was a week of presentations on subjects core to developing software using current Microsoft Technologies.

It was a good week, but because it was paid for by work it has been the subject of a few posts on my work blog – go and check there if you are interested in the subject matter.

Barcelona was really nice and due to travel arrangements I had the opportunity to have a look around on the Monday morning of the week – it is a lovely city and due to the number of English speakers I managed to get away with not knowing the language – it helped of course that the conference was in English. I might even take Mrs AlistairL across there sometime.

Interacting with parent controls in Microsoft Dynamics CRM 4.0.

If you do a search in Google on the title above, you’ll find plenty of code samples of the javascript to get and set the values of controls on CRM 4.0 forms and even how to do it from an IFRAME in a page. As you may know if you have any experience of extending MS CRM 4.0, the IFRAME is a big part of offering extra functionality to users.

Of course, as you may know if you have a bit of a history in Web UI design, there are a few hurdles to be able to be allowed to run javascript if your IFRAME contains a page from a site that is different to the HTML page hosting the IFRAME. This so-called cross site scripting was a big problem in earlier browsers and security blocks added in to stop this being hijacked for nefarious purposes. To deal with this the form designer in CRM 4.0 has the option to switch this security on or off. Unfortunately this has its limitations and I found that the option did not have any effect on the script I was trying to run from the page in the IFRAME. In the end I had to create a virtual directory in IIS in the same website as CRM. The other part I had to watch for is that I used the URL from the root of the site, not the redirected path that the CRM application uses.

Once over that hurdle, I had a bit of a wrestle with Javascript and dragging it out of my brain at the same time! To explain what I was trying to do, I had two controls on the parent form to populate. No problem, I had the names of the attributes and CRM 4.0 has a nice way of naming fields and controls from the attribute names. Unfortunately I got an access denied error thrown by the script engine in the browser. By a process of trial and error I established that one control worked and the other did not. Not because of value types or anything, it was because one was a lookup and the other was a straight text field. Lookups need a different approach to accessing them, as they use an array as part of the matching to list setup.

Having established this, I dived in to the code in the Microsoft Dynamics CRM 4.0 SDK which is something like thus :

//Create an array to set as the DataValue for the lookup control.
var lookupData = new Array();
//Create an Object add to the array.
   var lookupItem= new Object();
//Set the id, typename, and name properties to the object.
   lookupItem.id = ‘{1AAC1363-01A1-DB11-8432-0003FF9CE217}’;
   lookupItem.typename = ‘account’;
   lookupItem.name = ‘A Bike Store’;
// Add the object to the array.
   lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
   crmForm.all.parentaccountid.DataValue = lookupData;

Fine, but what guid id is that and how was I going to find it out. Further searching established that it is the guid of the entity that is listed by the lookup. Finding this out was a bit of a hunt again. Firstly I found the name of the entity being looked up by checking the properties of the lookup on the parent form. This pointed me to the source entity. Then I navigated through settings to call up the entity. Doing this lined up a URL with the GUID on it – perfect. The typename was also shown on one of these property pages. I filled them all in, and it didn’t work. I did some cursing of Javascript and started hunting again.

I finally ended up wandering the directories of the SDK again. If you browse down the folders client\howto\usinglookups there are two script files readvaluelookupcontrol.js and setvaluelookupcontrol.js. I opened up the latter and it has the following code:

// Create a lookupItem to store the values that you want to set to a target lookup control.
var lookupItem = new Array();

// Specify the values on the signature of LookupControlItem. These values are the GUID of pricelevel, the type code of pricelevel, and the name of the lookup value.
lookupItem[0] = new LookupControlItem (“{F31BB38A-0EC0-403F-99A6-3AF469D7D76E”}, 1022, “Retail”);

// Set the form control value to the lookupItem that you just created.
crmForm.all.pricelevelid.DataValue = lookupItem ;

Ok fine, but the realisation dawned slowly that the second line of code was calling a function I hadn’t seen so far. I was correct, after doing some more Google work to establish this. Further hunting revealed that this is a function used by the CRM application itself. If you go hunting in Inetpub, you will find the file that defines the function. Take a look at the file Lookup.js which you will find under the web root in _static\_controls\lookup . In there is the definition of LookupControlItem thus:

function LookupControlItem(sId, iType, sName, sOnclick, sDisplayClass, sData, sTypeName, iCategory, sAmbiguousRecordsXml)
{
this.id = sId;
this.type = iType;
this.name = sName;
this.onclick = sOnclick;
this.displayClass = sDisplayClass;
this.data = sData;
this.typename = sTypeName;
this.category = iCategory;
this.ambiguousRecordsXml = sAmbiguousRecordsXml;
}

Include the code by reference or placement, and call it in the style above and it will work.

Its up to you whether you wrap your parent call in a test (helpful for form load timing issues) but I found this worked in the end.

So the SDK is ok, but needs a bit of background knowledge to work with. Another really helpful file that comes with the SDK is a pdf of the Microsoft Dynamics CRM 4.0 UI Style Guide. Essential to match your UI to the rest of the CRM look and feel to make your IFRAME disappear – if you can work CSS and Style of course!

Thanks to Richard at Evorio for CRM support.

Further catchup with the world of AlistairL

I think I would be better off with Twitter than these summary posts, but such is. These will placeholder my life until I get my thoughts down in more detail:

  • A week last Friday I took Mrs AlistairL out for a Fish Tea at the Tailend restaurant in Albert Place. Alegedly related to the management of the Anstruther place at one time, they managed to squeeze us in without a table booking and the fish and chips was excellent. The dining room is a bit small, so look it up in advance and book. Recommended.
  • I had “fun” this week wrestling with some UI work regarding customisations to Microsoft Dynamics CRM 4.0. A search around the blog postings on IFRAME Javascript calls to parent forms shows the same but frankly useless code example. I’ll spare you a rant on this sort of stuff, just remember that some folks don’t try the sample code they blog. I got it figured with a bit of code from the SDK, a bit of code from a blog posting (I know) and a function “borrowed” from the CRM js libraries. And that was after virtual directory fun in IIS. Full posting to follow.
  • Had a lovely brunch with Mrs AlistairL at S Luca in Morningside, she had the Vegetarian, I went for the French again with extra bacon (poached egg, bacon, muffin with Hollandaise sauce – yum).
  • I’ve stepped in to the breach at work and volunteered to take an exam at short notice (for me). I am booked to sit 70-630 TS: MOSS 2007, Configuring on Monday 8th September.
  • I bought a rorty exhaust for the RS from ebay this week (a bargain). Work are getting used to me carrying motorbike exhausts home from the office.

Catchup with the world of AlistairL

I do these catchup posts from time to time, when I go through a period when I’m not in to keeping the blog up to date. Happenings include:

  • Cat MkII. After keeping her resolution not to have another cat, two weeks after the departure of Cat MkI I accompanied Mrs AlistairL to Dalkeith to meet a little female kitten being fostered with her brother and mother by the Lothian Cat Protection folks. After an hour of play we departed with a little 12 week old black male kitten who is now called Luey. He plays most of the time he is awake and sometimes will play fetch – bringing items back that you throw for him. His little black and white sister didn’t want to play as much – apparently female cats can be like that.
  • New Tyres – put a set of new Bridgestone BT-021s on my bike, which is all back together and working after my tumble. Maybe I blogged about that.
  • Kung Fu Panda – Took Mrs AlistairL to see Kung Fu Panda at the IMAX in Glasgow. Enjoyed it and going to see the Dark Knight on Saturday at the same venue.
  • IAM Motorcycle Observing – I have been helping someone work towards their advanced test. They ride a Fireblade, I’ve not lost sight of them on the ride outs so far.
  • Shiny valve caps – I bought these as one of the other Motorcycle Observers said they were better (they have a seperate seal in them) but the young folks in my street seem to like taking them off my bike and car. After two weeks of replacing them every other day I have given up and gone back to black.
  • New Phone – After enjoying my Orange SPV M600, I have now got a black and shiny HTC Touch Diamond. Doesn’t have a memory slot, but hangs together pretty good. Yes I know it is not an IPhone but neither was the price. Unfortunately the supply chain of accessories is as stuttery as the phone supply chain – I’m waiting on a cradle and one of those strange HTC extended USB cables.
  • SharePoint and Microsoft CRM – I did two courses in the last month or so, one on Microsoft CRM and another on MOSS 07, or SharePoint as we commonly call it. Both are superb products and I’m looking forward to using them.
  • Writing – I wrote a short article covering the Scottish IAM Motorcycle Senior Observer’s day in April and it has been published along with a photograph I took on the day. They went in to the Motorcycle section of the summer 2008 edition of Advanced Driving Magazine, the members magazine for IAM Members.

Ron Jacobs is back with endpoint.tv

I used to subscribe to a podcast called ARCast, which was an architecture Podcast from Microsoft, hosted by a chap called Ron Jacobs. I used to listen to it on the bus to the Business Analysis job I was doing at a Corporate Bank. They fitted in quite nicely, I could get 1 to 1.5 podcasts in on my ride into Edinburgh on the X25.

When that job finished I was back to commuting by car and didn’t listen to my MP3 player as much, but my RSS reader kept downloading the files and adding them in to the Media Player sync list. From time to time I checked back and discovered that ARCast wasn’t producing any more files. As it was, Ron Jacobs had moved on to pastures new. Moving from Architecture into deeper technical stuff.

So here I was trying to get to grips with WCF again for a bit of a project that wants to connect Microsoft Office SharePoint Server to Microsoft Dynamics CRM and I came across the total noobs guide to WCF Lesson 1. And this time, Ron Jacobs is in your face – well for a short time until he gets in to the code of a WCF service. This is a great primer and I look forward to the further lessons. If you want a bit of amusement, look behind Ron at the beginning – you see a kid wandering about, then trying to crawl past so as not to appear in his video. Superb.

Good to have you back, Ron.

Application Deployment and stuff

Work continues to be interesting, I’m currently involved in a project packaging up a large application we wrote for a Financial Instituion. This involves scripting everything on and off the target machines using their chosen deployment API.

Another learning curve, but good discipline for the end of things that developers don’t tend to like. By the end of a project anything would run on our development machine because we’ve installed the contents of downloads.microsoft.com over the months, but show it a clean machine? Bang.

We’re making great use of Virtual machines to configure and test this stuff, they are just superb things even if they are a bit resource intensive.