Monday, October 28, 2013

Synchronous On-Demand Workflows in Dynamics CRM 2011

Previously, I talked about building a work process in CRM 2011 if you are unable to move to CRM 2013 and make use of the new process flow functionality. In this blog I talk about another way you can approximate CRM 2013 functionality in CRM 2011. Specifically, how to create synchronous on-demand workflows in CRM 2011.

Workflows 101

Anyone who has worked with workflows in CRM 2011 knows that they run asynchronously i.e. not in real time. The workflow is triggered and then put in a queue for processing by the Asynchronous Service when the opportunity arises (generally within a few seconds of hitting the queue). This means that, for example, if my workflow creates a record, this record may not be immediately available to the user when the workflow is triggered. This can cause confusion but is usually managed as part of the training process.

The Traditional Workaround

To get around this issue, the best approach is code. For form behaviours, there is jscript and for record management there are plugins. However, if you are looking for a codeless alternative, albeit, as usual, a slightly less elegant one, here it is.

Pageless Dialogs: 2011’s Synchronous Workflow

Unlike their cousin the workflow, dialogs run synchronously. Unfortunately an in-built requirement of dialogs is that they contain a page and a prompt and response.


So how do we get around this? The simplest way is to embed a Prompt and Response in an If Statement and make it so that the If Statement is never satisfied. By the way, I remember reading about the possibility of circumventing the Prompt and Response on a blog years ago but cannot remember the source so, if this is you, thank you for providing this trick and giving me the mental foundation for this workaround.

So, for example, if we want to synchronously update a field, we can do this:


We will still need to manually refresh the form to see the change but the change itself will be synchronous. Other things we may want to do synchronously include:

  • Create a record
  • Assign a record
  • Change status

Pros and Cons

As previously mentioned, a coded approach is a lot more elegant in terms of visibility to the end user; code behaviours just happen. In the case of my approach, the user must select the dialog and click the Finish button when the dialog is finished but when they have done this we can guarantee the changes have been applied.

Given dialogs can only be triggered on-demand, we are restricted to only creating on-demand synchronous workflows; for event-based workflows our only option for making them synchronous is still code.

One big advantage though is the ability to access the additional steps and functionality in dialogs, not available in workflows such as CRM Query, Variables and the ability to pass arguments to child dialogs. These are powerful functions and it is a shame that, even in CRM 2013, workflows do not have access to these functions.


Obviously, the best approach is to move to CRM 2013. However, if this is not an option, and you are loathe to write code for something which may well become obsolete when you eventually upgrade, this trick provides a codeless workaround to common CRM process requirements where the process is initiated by the user and needs to run in real time.

Monday, October 21, 2013

Upgrading My Surface Pro To Windows 8.1

I upgraded my Surface Pro 128Gb this weekend so I thought I would share my experiences and thoughts on whether others should follow suit. In short, take the usual precautions and then go for it.

When Will My Surface Auto-Update?

I was waiting and waiting for Windows Update to apply the upgrade but it does not work that way. The Windows 8.1 patch/update does not come down to the Surface Pro automatically but, if you go to the Store, it should be the first giant window you see.


You install it like any other app. The main difference being it is a big download; 3Gb of big. I have seen complaints about this on the web saying how Apple would never release such a large patch etc. To be honest, never having owned an Apple computer, iPhone or iPad, I have no idea how stream-lined and floral-scented the Apple upgrade path process is.

For myself, as the big download happened in the background, it was not a big deal; I started it in the morning and a few hours later (our internet is not the fastest in Australia) it told me it was going to reboot in 15 minutes and get the process going. I finished playing my level on “Where’s My Water 2” and rebooted.

I have read about people having a few issues with the upgrade on general PCs so, obviously, back up before applying the upgrade. I had a file backup from a few weeks ago so, for me, this was good enough.

My biggest concern was hard drive space; Of the 128Gb, I was down to 10Gb. For those that have seen my other Surface reviews, when I first got the machine, at the end of February this year, after installing the essentials, I was down to 50Gb of free space. By June, this was at 20Gb. With the space going, it looked like I would be purchasing a Surface 2 before the end of the year. Thankfully, the upgrade to Windows 8.1 has literally saved me hundreds of dollars by putting off this looming apocalypse.

Windows 8.1 Frees Up Space

This is my hard drive as we speak.


I now have almost 40Gb of free space on the hard drive! Upgrading to Windows 8.1 has made close to 30Gb appear out of nowhere. So what has happened?

Unfortunately I did not screenshot pre-upgrade because I was not expecting such a dramatic change. To be honest I thought I would be down to 5Gb and looking to jettison old iso and avi files but this was not the case.

The best we have is my June screenshot where I was at 22Gb of free space. The main folders which are smaller since then are the Users folders (reducing in size by about 4Gb), the Windows folder (also reducing by about 4Gb), ProgramData has lost about 6Gb and System Volume Information has gone down about 3Gb (22Gb+4Gb+4Gb+6Gb+3Gb = 39Gb). The User directory is mostly my profile account. I had sorted through about half of my 10G of unsorted files so this is probably where this space gain came from.

The Windows folder, I assume, is because Windows 8.1 does some spring cleaning with the upgrade. The Avast! antivirus logs had been reduced since June so this could explain the reduction in the ProgramData folder. Finally, I do not have a solid idea why the System Volume Information is smaller. I do see that the SystemRestore sub-folder is empty so, perhaps, again, this is some spring cleaning.

The amount of free space has fluctuated between the high and low thirties over the past 24 hours but this is still a lot better than 10G.

The Actual Upgrade Process

On my Surface Pro, this was painless, although it did take a while (presumably, in part, due to the freeing of 30G of space). You will see a lot of spinning dots, percentage counters slowly increasing, a few reboots and some cutesy commentary like “Fixing up a few more things”. Once this is all done you should be good to go. I did not time the process but set aside an hour and you should be ok.

Any Problems?

Problems were minor. Firstly, the pretty, stylised picture of Seattle has gone from my lock screen and replaced with some brightly coloured concentric circles (although the old picture can be restored in settings). Also, my desktop picture has been replaced. The other issue is my Windows Phone is now displaying the old Live ID icon for my details rather than my previous Facebook icon, which it had shown pre-upgrade. I assume this is a ‘last change wins’ issue and, if I go to Facebook and re-apply my ‘table dancing’ icon, it will sync to the phone.

I have not adjusted any of the ‘issues’ yet because, frankly, none are a big deal for me.

Finally, some of my Metro applications no longer work. None of these were essential or even regularly accessed and so I have simply uninstalled them and not given it a second thought.

What Has Changed?

I have already mentioned the space which has appeared. Fellow CRM MVP Joel Lindstrom believes it is due, in part, to the changes with the way Windows 8.1 uses SkyDrive. For existing users of the SkyDrive application, nothing has really changed as you still have your SkyDrive folder.


The biggest difference for me was, before, I could only add a limited number of folders to my SkyDrive folder because there was no choice but to sync them down to the local drive (unless you accessed them via Internet Explorer or the Metro SkyDrive app.) Now, with windows 8.1, all folders are visible under the Skydrive folder but are all virtual cloud folders (except ones you were syncing locally, pre-upgrade). You can right-click on a folder to make it sync locally but I will probably only do this on an as-needed basis.

This change means it is much easier for me to manage my SkyDrive content from the File Manager. For example, it is quite difficult to manage the space your SkyDrive account is taking up through the web client or Metro app and with only certain folders being synced locally, pre-upgrade, it meant this also did not give me visibility of the files in my account. Now I can run my TreeSize application and manage SkyDrive as if it was just another drive. Prior to upgrade, I used my son’s computer to store a full local backup of my SkyDrive, via the SkyDrive application, so I could manage the space. This will no longer be necessary.

You may also know that the Start button is back. I had installed a Start button emulator prior to upgrading, which I uninstalled before going to Windows 8.1 but the new one covers the essentials. The new start button does not bring a lot to the table and is equivalent to hitting the Windows button when you pen-tap or left-click it and is equivalent to the Windows 8 Windows-X when you right-click it. I still welcome its return though.

The upgrade also comes with a new version of Internet Explorer (version 11). While recently abandoning IE10 for Firefox, I find myself, again, giving Microsoft one more chance, switching my default back to IE. No freezes or crashes so far but my IFD CRM 2011 instance does not like it, showing me the Express client rather than the normal web client. I assume a rollup will come to the rescue on this one.

Finally, you can, like in a Windows phone, adjust the size of the tiles in the Metro screen (the tile settings are now accessible in the same way as the Windows Phone i.e. press and hold, rather than down-drag and release). You can make tiles really big or tiny. I like this flexibility but, like my Windows Phone, it is not always obvious whether a tile is active or not, without sitting there to see if it changes. Because of this, it is not always obvious what the optimal size for a tile should be (do I make it small and miss out on tile notifications, or bigger, wasting real estate just in case it wants to tell me something?). A suggestion for Metro app makers; provide information or a setting to optimise the tile size to ensure the best user experience. I did notice the dragging around of tiles is greatly improved and less ‘shaky’ than it was in Windows 8.


I say if you are running a Surface Pro and have the spare 3G of space, go for it. Obviously, back up your data and make a note of the applications you have installed (checking online if there are critical ones which you may think will not survive the process). My experience has been almost exclusively positive and, with my additional hard drive space, I can spend my money on other things than a premature machine upgrade.

Saturday, October 12, 2013

Building a Work Process in CRM 2011

CRM 2013 brings a range of new capabilities in terms of managing processes. From the new Flow UI form which walks the user through the steps to complete the process through to form management via synchronous workflows and the new ‘business rules’ configuration.

While the form management can be reproduced in CRM 2011 with jscript, there is no equivalent of the Flow UI. The best we can do is generate tasks via workflow. I recently had to do this for a client so I thought I would go through the steps here.

A Simple Sales Process

Let us say our process is:

  • Stage: Contact Prospect
  • Stage: Negotiate Contract
  • Stage: Opportunity Won

Here we move from one stage to another by completing the necessary actions until we finish and win the opportunity.

The Workflow


A much simpler workflow is one where it creates all the steps at once. In that case the workflow is simply a series of ‘Create’ steps. This one is a bit more complicated but the behaviour is also a lot more complex in that it creates the tasks one at a time, the next one appearing as the previous one is completed.

The workflow kicks off when the opportunity is created and stays alive while the opportunity remains open.

The first thing it does is create our first task, ‘Contact Prospect’. A good idea with these tasks, especially if you are planning to generate a lot of them, is to incorporate unique information into the subject so that when all the tasks are listed, you know which ones relate to which opportunity.


The trick is we then wait until the task is completed or cancelled. We do this with a Wait step. In my example, the action following the wait is blank. The code purists would nest the next step into here but workflows in CRM have a finite number of nesting levels so, in this case, I simply put the next Task creation below the Wait step. As the workflow will not move on until the wait condition is satisfied, the end result is the same.

There is one final trick in my Wait step in that I have used a ‘Parallel Wait Branch’, one of the lesser used workflow steps. This allows us to specify multiple conditions for the wait and if any of them become true, the workflow moves on.

In this case, either the Task is closed or the Opportunity is closed. If the Opportunity is closed, the previous Task is cancelled and the workflow is forced to stop, as it is no longer required.

Finally, once all the tasks are complete, we can, if we wish, add in a Change Status step to the workflow to automatically close out the Opportunity.

The net result is a series of tasks which appear one at a time and guide the user through the process to closing the Opportunity. If the Opportunity is closed out at any point during the process, open Tasks are closed for us and the workflow is stopped.


If, for whatever reason, you are not in a position to upgrade to the upcoming CRM 2013, this is one way you can create a series of steps for a user to walk through to complete a process. While slightly harder to manage than a Flow UI process, it is still codeless and configurable by a power user.