Charteris Community Server

Welcome to the Charteris Community
Welcome to Charteris Community Server Sign in | Join | Help
in Search

Alistair Laing's Blog

  • How to extend and Integrate Groove - Tech ED EMEA 2008 Developers

    I sometimes think of Groove as the poor cousin of the office suite, to many it is the application with the funny name that appears with the other tradition Microsoft office tools such as Excel or Word that everyone uses. Doing a bit of background reading before the session started didn't really help either, most articles online spoke more about Ray Ozzie as an individual than the product that brought him and his company into the Microsoft Fold.

    The session here at Tech Ed Developers had a little of an inauspicious start too, although billed as a joint interactive session headed up and moderated by Fabrice Barbin and Mark Ryan, only Fabrice was up there at the start looking rather perplexed as to his colleague's absence and suggested that the morning of the last day had caught up with Mark.

    Fabrice Barbin extends and integrates Groove

    We were treated to a view of the capabilities of Groove, from the basic "this is what it does" with a dusting of "this is how it works with SharePoint" we were also treated to an introduction to its support for developers and a hint at the future. All in all, I came away with the impression that despite the name "Groove", the product isn't what I would call funky but it brings with it concrete, solid, and very useful functionality to get the job done. It allows individuals on the same network to share and collaborate, with a distributed and peer to peer model for synchronising files around a workspace. It encrypts storage and traffic, and is happy offline and online. Workspaces have members and for the period of time that they work, the workspace is active and then can be archived when things wind down. To help step up to the next level, it offers a server to allow users from different networks to join in the fun, and can integrate with the document library storage in SharePoint.

    All solid stuff, and it works. It also has a forms capability - which is great for a formal setup but for me kind of pins down the "get on with it" philosophy that I see in the rest of the product.

    As borne out by Fabrice, Groove as a company really bought in to the .NET philosophy and in what I see as a really unusual feature from a product that started outside Microsoft, the API support, object model and web service arrangements all look like something I would expect of a product once it had bedded down in Microsoft. In fact, I think the work on Groove in upcoming versions is to blend it functionally in to the SharePoint world of things so that people don't overlook the proper capabilities it has that aren't anywhere else. Sure, you can check out a document and use it offline but Groove is the bit that allows you to make lots of progress within the boundaries of your workspace without worrying unduly about missing the other information that has been uploaded or having that multitude of mobile phone calls from colleagues asking you to check in that document so they can add their bit. Although blocked by NDA, Fabrice reassured us to an extent that Groove was going to me a bigger part of the SharePoint story.

    What really made me thing at the end was a response by a guy who I took to be Mark Ryan who had joined us towards the end of the session. In the QA at the end one of the attendees complained that it was difficult to make a strategic recommendation for a company without knowing about the current product (the session covered this) and what was in the next. The point made was that you don't bet your company on Groove, it is a tactical product. On first hearing this struck me as a strange statement, but on reflection it hits the nail on the head. You set up a Groove workspace, you work on that project or bid, then you close down and archive the workspace. This does not last for months or years, it might just last for weeks. That is where groove fits in.

    Key Facts:

    Session Code: OFC05-IS

    Speakers: Fabrice Barbin, Mark Ryan

    Track: Office and SharePoint

    Rating: 8/10

    Attendance: 10

  • How to position and propose SharePoint inside your organisation from a developer perspective - Tech Ed EMEA 2008 Developers

    This session on SharePoint was positioned as an "Interactive Session" so I was interested to see the difference between this and the more traditional "breakout" sessions which basically mean a presentation in a smaller auditorium. I went along to join the session and it was in a relatively smaller room (capacity around 150) and we were invited to ask questions as we went along. The presenter had also picked a lot less slides, summarising his own experiences with developers and SharePoint.

    The discussion echoed some of my own experience with Server platforms like SharePoint. To take one product example, in the past I have used versions of Microsoft Commerce Server to deliver internet retail websites. My own experience from an architect and team lead perspective is that with some developers I had a job to persuade them to learn how to code against the product rather than using their own code and accessing an underlying database directly. Some developers (generally the minority) are happy to buy in to the idea that a server product will save them time, others view it as less of a coding challenge and do not want to know.

    Anyway, back to the presentation. Gianpaolo Vittorelli of Microsys started by reminding us of the history of SharePoint and the "all things to everyone" difficulty it brings. Everyone (not just developers) ask if SharePoint is an Intranet Toolkit, a Document Management System, a Knowledge Management and Collaboration Tool or a Development Environment? Or is it all of these - which it can be. In fact, Gianpaolo claimed that in order to assist with a demonstration, you should cover preconceptions in advance of a meeting before they are even shown the product.

    On the theme of limitations and preconceptions, Gianpaolo showed an example of an Intranet that his company had created for a company to manage photography. It was still SharePoint, but time had been spent by a design company and creative developers to give the customer what they wanted, even if this was to spend a lot of money on the correct font.

    One point that Gianpaolo really wanted to emphasise is that in his experience, it is not necessarily the effort of learning and developing against SharePoint which is the biggest challenge, but the types of business that can prove tough for a developer. For instance, Human Resources and Communications departments are two of those that are really interested in what SharePoint can do for them, but they can also be tough to gather requirements from because of the type of people they are. In fact, I would probably go as far as saying that out and out coders are probably at the other end of the spectrum in terms of social skills to the people that excel in HR and Comms roles. HR and Comms are all about people, whether it is concerned with their career or whether it is to do with managing their perceptions.

    Another point that Gianpaolo acknowledged is that SharePoint can be a struggle to get to terms with because it is a sophisticated product, take a look at it and there is lots going on and lots of concepts. He did make a valid point though, which is that any sophisticated product takes some effort to learn. All developers have had the experience of joining a project that has started, and the headache of picking up functions, code and team roles. The only time that you don't have that is when you have been there from the start - perhaps years before.

    So it also does well to have an element of caution, SharePoint is sophisticated and requires management. Users can do a lot of damage if they use the full admin capabilities, but developers can do even more damage with their tools, but this is again true of any equally sophisticated application.

    But two points were emphasised in building the case for Sharepoint; firstly that it helps your project to get further faster, and this will keep the users at bay, but also unlike other development projects, one mark of a successful SharePoint project is that it never ends and rather continues to grow and get adopted by more and more departments. This could be argued to be different projects under a programme of work, but I guess you and I get the point. I put my question to Gianpaolo of how to stop developers bypassing SharePoint (and got a usb stick for asking a question) to which he reminded us of the potential problems at upgrade time or the risk to the product as service packs may change the schema. He also suggested a more extreme way of dealing with such a developer, but discretion prevents me from repeating that part of his reply.

    Key Facts:

    Session Code: OFC04-IS

    Speakers: Gianpaolo Vittorelli

    Track: Office and SharePoint

    Rating: 9/10

    Attendance: 40+

  • How I am using Live Mesh during my visit to Barcelona

    With mention of Live Mesh together with the Azure announcement at PDC recently, and the fact that Mesh is one of the few services out there in public beta, I thought I would share a little of how I use Live Mesh and in particular what it is doing for me during my visit to Tech Ed in Barcelona.

    I have signed up for pretty much all of the "get data from us" services from Windows Live and Office recently, so at the moment I have a few gigs of storage on office live, a few gigs of storage on Windows Live Skydrive and now a few gigs on Windows Live Mesh. What mesh gives me over these services is the device synchronisation.

    If you are anything like me, you will have a work PC which does the job for you - whether a developer specification machine or something that project managers can hack spreadsheets with. From time to time you end up taking work home, so it either gets emailed or stuck on a USB key (now that floppy disc drives don't even come as an option). But inevitably the usb key gets left at one end or the other of your commute (safely I must hasten to add), or you forget to email it - not impossible to work round but tricky. The reverse is also true, I stick ideas and all sorts of daft stuff in word documents and spreadsheets and the inspiration doesn't necessarily hit me in a consistent place.

    What you and I can do with Mesh is to have a set of folders in my mesh, which I selectively synchronise to the devices which are members of the mesh. I can decide which folders have local copies on each device and which are left. I must admit up till recently I had all of the few folders I have synchronised between my personal PC at home (solely used by me) and my work laptop (generally just used by me). But recently I added in my old PC, which my son uses, and now my HTC Diamond since the mobile client was updated recently. I would have added my personal powerbook, but support for mac is only offered for intel machines. So to try the technology at Tech Ed, I have added the photos folder from my mobile phone to the mesh and I have been taking photographs of each session I attend to add to my blog entries. I take the picture, log on to the conference wifi and tell mesh to synchronise. Then I can lift the picture straight in to the blog entry for that session.

    Another feature I haven't mentioned is the ability to do a "remote desktop" to machines that are on the mesh. As mesh is installed as a service, once the machine is on (and if the user on the machine permits) you can connect to the machine "as if you were there". This is really handy to access my PC at home and download emails into Microsoft Outlook as one example. To enable this, I have also set the BIOS in my PC to start itself up at a set time every day. So I can log in through mesh once the PC is on, check things over and then switch it off for the next day.

    The Beta has been running for a while, and functionally stable - the only hassle being that my home firewall has to be reset to allow the correct ports each time the client updates - which has been quite regular of late. Of course, this is all convenient for me, and it could raise questions in your mind about privacy and data protection so I have thereby been quite cautious about the sorts of files I place in the mesh. I would also say at this stage that I struggle to think of appropriate business use of the technology, but from an individual with interest in a number of different machines it has been really useful.

  • SharePoint Technology Past, Present and Future in a SaaS World - Tech Ed EMEA 2008 Developers

    All fired up from the Keynote presentation, the delegates at the Tech Ed EMEA Developers conference all dispersed to the various breakout presentations across the conference centre. I headed off to the first of the SharePoint presentations on the Office Track. This was SharePoint Technology Past, Present, Future in a Software as a Service World. To begin with I was interested by the title, being as Microsoft are always keen to present themselves as a vendor in the Software plus Services space.

    The session was presented by a name I knew well; Arpan Shah. In fact, if you search for "Arpan" in an internet search engine, he is most likely to be in the top one or two results in the search. Arpan explained at the beginning of the session why he was familiar, way back a number of years I was heavily involved in web development for large Internet sites and Arpan was well known in the Microsoft Content Management Server (MCMS) world and when this became part of Microsoft Office Server, so did he. His session was going to be a little bit of a history lesson, a little bit of a short term plan and a bit of long term plan. Unfortunately, he told us from the outset that he would not be disclosing anything about SharePoint 14 as this was too far away.

    IMAGE_024

    On the other hand, using the principle that it didn't count as disclosure if it had already been announced, Arpan reminded us that SharePoint Online would reach Europe in the first half of 2009, and that MOSS 2007 SP2 would be with us between February and April 2009. And he told us that SharePoint 14 would be 64-bit only.

    Then to the presentation. In common with other SharePoint presentations featured a similar slide illustrating SharePoint's assistance with the principle of the Long Tail from the article by Chris Anderson in Wired Magazine. The idea of the principle is that self service and individualisation will actually provide more that catering to the small majority of features in that 80% of functionality we try to implement. This idea relates quite well to SharePoint, but if you are really interested there is also an interesting debate on the principle that has been started by TheRegister about the empirical view of the Long Tail principle. I suspect that a version of the Long Tail will prevail, but the challenge of the debate should be helpful in providing some up to date empirical challenge to Chris Anderson's original ideas. Some elements are difficult to argue with, for instance that as IT is a limited resource that it has to concentrate its efforts somewhere. IT has a challenge in justifying that focus, and proving that it is as efficient at doing things as it should be. In the public facing world, web sites that have ridden the Web 2.0 wave like Facebook and Youtube and Amazon as a business model would seem to suggest that Chris Anderson has a point.

    What they do prove is that for any kind of success you need People in the driving seat, and those people want functionality i.e. they want a service that they can understand and they don't particularly concern themselves with protocols, algorithms or architectures.

    The presentation then considered SharePoint's place in provisioning these services to the enterprise and beyond, and to do this Arpan considered a history of the product. Going back a few years to consider products such as SharePoint Portal Server 2001 and 2001 Team Services, products absorbed like Microsoft Content Management Server 2002 and up to what we have today in Microsoft Office SharePoint Server 2007. With server products have been the tools to assist in configuration, design and development and there is a spectrum from the extensive work that can be done in the web browser, through the Office suite of rich client applications through to Visual Studio with the SharePoint extensions and their various project types and components.

    We were then shown a demonstration of development of a web part and the process of debugging it. On this we were pointed to the newly published guidance from the Microsoft patterns and practices team. SharePoint Guidance - November 2008 covers design and architectural guidance for SharePoint including a reference implementation. I have not had the time to review this in detail but will cover it in this blog when I have opportunity. Some other tips came out in his presentation, including reminders not to modify the SharePoint database and remember to dispose of objects properly in code.

    We then went on to look at a popular subject of late, Silverlight. Silverlight is of course up to version 2.0 now and can be considered to be fairly mature as a product, and it has been inevitable that it would be used to answer the challenge of all SharePoint implementations looking the same in that rather functional way that they do. It has the potential to be a great answer to the "Can you make it not look like SharePoint" request, providing you engage a proper designer. A key point to remember with Silverlight is that like a few other Web 2.0 approaches, a lot happens client side so you have a few options in arranging your architecture between Silverlight (a client technology) and SharePoint (a server technology). These should be pretty familiar however if you have any recent experience in web application architecture and deciding between server side, client side, ajax, web services etc.

    Although a simple demonstration, we were shown a quick example of how Silverlight can interact with a library with a traditional map based mash up which came across as impressively simple - proof of the pudding will depend on a real business solution though.

    We finished up with a look at futures and some confusing product naming, so apologies in advance if you read through this and end up confused. The recent PDC announced Azure with three service layers. One of these layers features something called SharePoint services, but this has not yet been released in any form (unlike the others, like Mesh which I already use in Beta) and is not the same as SharePoint online.

    Something in the nearer future is SharePoint online, which should be arriving with us in Europe in the first half of 2009. This is a hosted MOSS 2007 solution in two brackets; standard is a multi-tenanted solution for implementations of under 5000 users, has certain limitations in what you can deploy to it and can take up to 1Tb of data. Dedicated can take over 5000 users and as the name suggests is hosted on dedicated hardware and comes with extra flexibility as a result. Both options support most (if not all) of the Microsoft Office desktop integration that is really helpful in organising documents. Arpan was really excited by the single sign on functionality of online, but I must admit that I will have to research better to form an opinion.

    In summary, the presentation was like a few others in trying to sell SharePoint to developers which seem reticent to use anyone else's code that they think they can write themselves, although they have been happy for years to use the .NET Framework, ADO.NET etc and I hope it is just a matter of time before they get used to the services available in SharePoint.

     

    Key Facts:

    Session Code: OFC201

    Speakers: Arpan Shah

    Track: Office and SharePoint

    Rating: 8/10

    Attendance: 300 (95% full)

  • Keynote Address - Tech Ed EMEA 2008 Developers

    Me and a few thousand other developers got together in the main auditorium at the International Convention Centre in Barcelona to hear the Keynote address for Tech Ed EMEA 2008 Developers. The previous week over 5000 Infrastructure specialists had convened at the same location for the sister conference for IT Professionals.

    The attendees from Charteris had all flown in the day before, so we convened over dinner to discuss the best way to absorb the most from the conference. One tip that Roger Whitehead gave us was to get along to the keynote early as it would start filling up 45 minutes before the scheduled time. So we made sure to get along early and get our place in the main auditorium. We were treated to some loud music by Loomis and Jones to get us all excited and ready for the presentation and to set the scene for the week ahead. Looking around, the auditorium seemed to be filling with a similar number to the previous week, if not more, and although the auditorium was a typically austere collection of black walls and surroundings, the orange of the Tech Ed backdrop attracted the eye to the visual display put up by the DJs.

    To introduce we had Pierre Liautaud, Microsoft VP for Western Europe. He was there to help us get excited about the event and put it in context, it was the second of the two week Tech ed at the conference centre in Barcelona, and 5000 IT Professionals had gathered the week before. We were to expect lots of great content and cool demos for what is one of the best times to be a developer. Why? It is one of the best times because the PC is currently the most popular development platform and this was the conference in Europe to show how to use it.

    As you may or may not know from reading the other blogs, these four weeks are quite busy from a conference perspective with Tech Ed EMEA coming hot on the heels of the PDC Conference a couple of weeks ago. Inevitably the big Azure announcement was featured, with the Microsoft emphasis - this is not plain cloud computing, but computing where you run the application where it makes most sense - not just in the cloud. It was then good to see a map illustrating the investment by Microsoft in Europe with 24 Innovation Centres, 13 Research and Development Centres and 4 collaborations with Universities. Although there are only two R&D centres in the British Isles, the centre in Cambridge is one of the most established in Europe. Mention was made of the Microsoft acquisition of FAST in Norway, specialists in Enterprise Search, but in Internet Search Microsoft are establishing European centres in Paris, London and Munich - because they think that there is still scope for innovation in that space.

    IMAGE_022

    Having been warmed up by the potential of software - the magic that enables the world, we got to listen to the General Manager of the Visual Studio Team for the remainder of the keynote. Jason Zander was obviously revelling in the opportunity to show off some development work, although he admitted that day to day coding was something he did 10 years ago on the CLR team. He was going to let us in to the exciting elements of the upcoming version of Visual Studio, VS 2010 and concentrate on what he described as four "pillars" supporting developers in dealing with the challenges of our time. These four pillars are:

    1. Understanding Code - we have all been on projects where we are the new guy, or we are in a team and they bring someone in half way along and you just think it would be easier to get on with it than answer this guy's questions. To try and help them, Visual Studio 2010 comes with a number of visualisation and analysis tools to explain code, show interdependencies and show calling sequences. Architectural discovery tools have been enhanced to help understand and refresh the memory of those looking at the code for an application. To help with the quality of code and its deployment, Test Lab Management has been introduced. For instance, when a tester is running a manual script, Visual Studio can record a video of their steps, and can capture debug information. Instead of relying on the tester's memory at the time it supports their efforts in the background and adds that key information that really helps the developer to understand how and what happened to the application (and also to believe what the tester reports!).
    2. Building Web Applications - Carrying on from the test driven development approach, a number of elements have been added to assist with the building and control of virtual environments - essential for the multi-tier infrastructure of web applications. And a little thing that they have added at last - config transforms to properly adjust all of those dev / preprod and production web.config app.config and all the others through deployment environments.
    3. Create Office Applications - I didn't note mention of SharePoint "14" but the new library support for SharePoint greatly assists the development and deployment of SharePoint work. That said, we were all reminded of VSeWSS (Visual Studio extensions for Windows SharePoint Services) because that is a stated upgrade path to the new functionality in 2010.
    4. Power of C++ - Now I'm not going to admit to any real knowledge of C++, I have dabbled in C in my time but unfortunately my lean towards business value has usually only left me time for scripting languages, with a good medium dose of C# from time to time. And I don't think I am alone from the 30 or so hands that went up when Jason Zander asked for a show of hands from those "unmanaged code" people. But he did go on to describe the assistance that VS 2010 will give C++ programmers in coping with all of the multi-core machinery that has been emerging from manufacturers for the last year or more.

    In summary the keynote is one of the few sessions (only two) where the whole delegate community gets together in one place and it was good to see the sheer numbers of people from across Europe and further that are really interested in making the best of their development investment in Microsoft technologies. The address certainly fired us up to get the most out of the following breakout sessions.

    Key Facts:

    Session Code: KEY01

    Speakers: Pierre Liautaud, Jason Zander

    Track: General

    Rating: 8/10

    Attendance: 4000+

  • Tech Ed EMEA 2008 The countdown begins

    The countdown timer on the web pages for registered delegates for teched EMEA 2008 is showing just over 22 hours, so all over Europe (and possibly the world) delegates are on their way to Barcelona for the Developers week.

    I have not been to Teched before, so this is a great opportunity for me to see first hand what it is all about. I am already making impressions, as mentioned in my previous posting the lead up involves picking sessions so that they can arrange the rooms to anticipate attendees. At the one Microsoft conference I have been to before there were popular sessions that were full as soon as the doors opened. If you were unfortunate enough to be at a session at the other end of the conference centre then you missed it.

    Looking at the agenda builder, a really useful page to select what item to attend in a particular slot, they have recently added an Outlook Synchroniser. Better than downloading the files individually in ICS form, which I did before, it manages all the entries that you have picked and adds them in to your outlook diary. This will then appear on my phone which synchronise over the wire to Microsoft Exchange. While deleting the items I had already placed in my diary (ok, its not perfect) I noticed changes to room numbers so it has already proved useful.

  • Tech Ed EMEA Developers Session Voting

    I received an email on Monday evening inviting me to indicate my session preference for Tech Ed next month. I have filled out my schedule online for the week and most sessions have fitted in around the SharePoint and office track.

    There are lots of fascinating sessions and the plan is that the Charteris attendees will post a blog entry for each session they attend, so check back during the week of 10th to 14th November to catch our view on what we have seen and heard.

  • Microsoft Dynamics CRM 4.0 SDK 4.0.7

    The Microsoft Dynamics CRM 4.0 SDK is an essential part of your toolit if you are developing against CRM, the latest release is version 4.0.7 and can be found on the Microsoft download site.

    The SDK has been changing fairly frequently so it is a good idea to check back regularly to see if an updated version has been placed.

  • Tech Ed EMEA 2008 Developers

    I and a number of my colleagues from Charteris are going to be attending Microsoft Tech Ed EMEA 2008 in Barcelona next month. As deputy of the Charteris Collaboration and Compliance Affinity Group, I will be focusing on the Office and SharePoint technical track. The plan is for Charteris attendees to blog about their views and findings from the sessions they attend, so keep checking back to see what we think!

  • Dealing with the Microsoft Dynamics CRM 4.0 Lookup Field

    If you have used or seen a demonstration of MS CRM 4.0, you will have seen the helpful lookup field - the form field with the search icon beside it. In MS CRM 4.0 it allows you to type a value and the validation will either resolve it to an item it knows about, or indicate that the value is wrong. A helpful combination control that allows more experienced users to proceed quickly through a form, but also provides for them and the less experienced to look up less often used items. Once it has found the item the text changes to a hyperlink so that you can view all of the information on the related entity.

    A recent project has required me to push values from an ERP system in to CRM. In functional terms think of the ERP system providing a parts catalogue from production management, and CRM needing to know a specific parts listing from a customer perspective.

    Coding against Lookup fields is a bit of a challenge to begin with, for instance the DataValue that they return is not a simple string but an array, so you have to parse it. Similarly in the reverse path, you need to set the values of the control with care. My original posting indicated an approach using information from sample code in the MS CRM 4.0 SDK. I stitched up the code based on what I could find in web postings and the SDK and this was setting the values and resolving them to the lookup.

    The problem I later discovered is that rather than the guid of the entity definition, what you should really pass is the guid of the instance of the entity. So even though the value looked ok and resolved ok on the form, clicking through on the hyperlink indicated that it was not a correct relationship to the other entity. Due to this I hunted for an alternative approach and found it via a blog posting to a Microsoft forum posting by Adi Katz in answer to a question on linking a lookup.

    The advantage of this approach is that there is no need to look up guids, and that the built in features of the lookup give a visual indication to the user if or not the item has been recognised. A fragment of the JScript follows:

    var LookupField = oCRMForm.all.new_producttype;
    LookupField .AutoResolve = 1;
    LookupField .SetFocus();
    ProductDiv = parent.document.all.new_producttype_d.getElementsByTagName("DIV")[0];
    ProductDiv.innerText = product;
    LookupField.Lookup(true, true, product, true);

    The interesting point I would take from above is to note that it gives you an idea of how form fields are translated in to the raw html in the background, it is knowledge of this that informs the above approach. The SetFocus() will also switch the active tab which can annoy some, but it allows the user to see immediately if the value inserted has been matched to an item on the list or not.

  • Interacting with parent controls in Microsoft Dynamics CRM 4.0 II

    If you read my previous post on interacting with parent controls from an IFRAME,  you will understand a few of the challenges I faced in trying to pass information from an IFRAME control on a MS CRM form back to fields on that form.

    In summary, as you are working with a browser application you need to have the correct conditions in which to pass information from what is one web site to another. To recap:

    • You need to switch off cross-site security for the IFRAME in the parent form.
    • You need to place your web pages in an IIS virtual directory underneath the MS CRM web root.

    The second point is fine, but I recently ran in to an issue with a development server. I was carrying out my small piece of development work remotely, which is a common model we use. I was dealing with the server by VPN and remote access. This is obviously not the normal mode of work, which would be for users to access the server over the network.

    Using the server by remote desktop meant a URL of localhost for me. This was fine, but when testing we found that we were getting a JScript "Access Denied" error on the line of code that was trying to set the value of one of the fields on the parent form. This was traced to a difference between the IFRAME URL and that in CRM. When the server domain is detected as being different by Internet Explorer, the protection against cross domain scripting is triggered and the JScript blocked from setting a value.

    The Microsoft Dynamics CRM 4.0 SDK has a section on "Creating a Dynamic IFRAME" the idea being that you can change the source of an IFRAME at the behest of your own code. This may be to set a particular parameter at runtime that is not normally available through the IFRAME properties, or for another business process related need.

    I wanted to set the source of the IFRAME to look at localhost when I was using the server from my remote development perspective, but to allow testing users to use the form page when they were accessing the server properly over their network. To begin with I considered using the global variable in CRM SERVER_URL but this returns the proper server name of the server, irrespective of whether you are coming from on the server or from another machine. Instead I used the hostname property of the Location object, which itself is part of the window object. This can be used in the form OnLoad event to check how the request has come through and sort the IFRAME appropriately thus:

    if (location.hostname=='localhost')
    {
        crmForm.all.IFRAME_control.src = '
    http://localhost/subdir/child_page.aspx';
    }

    That way the default is set to be "correct" for the common usage of the form, and adjusted for the peculiarities of development.

    My next CRM 4.0 post will be on my voyage with the Lookup Field.

  • 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!