Monday, September 22, 2014

Switching to K2 SmartForms mid project


I have been working with K2 products for more than ten years (since 2003) in various roles. Over that time there have been periods of frustration, especially where I have had to support solutions built by other people where they have used InfoPath and a lot of custom code in the workflows. We didn’t previously license the K2 SmartForms piece of the solution, and I have to admit that I was a little sceptical about how good SmartForms would be and how well it would be able to deliver on the requirements we have.

I’ve also been working with SharePoint since 2003. I am not really sad to see the back of InfoPath. Whilst for simple stuff it seemed good on the surface, so many times it got really complicated. I have also had some custom ASP.Net solutions built by partners which integrate with K2. These have also ended up feeling very complicated and are difficult to support. Also, because they are Full Trust SharePoint solutions, deploying changes is a pain, often requiring out of hours effort.

My initial path

I came to a realisation some months ago that I really wanted to get away from Full Trust solutions. This was partly driven by what is happening around Office 365 and also that ‘SharePoint integrated’ and ‘InfoPath integrated’ K2 solutions will only work in 2010 mode on SharePoint 2013.  This means re-writing the workflow/user interface to use the ‘non-integrated’ approaches. Also, I was pretty fed-up with having to deploy on Sunday mornings…

My experience with building workflow solutions during the past ten years leads me to believe that up to 80% of the effort in the solution is building the user interface.

Given that InfoPath is being discontinued and having looked at what was happening in the industry while at the SharePoint conference in Las Vegas, I decided to have a go at building a solution using HTML5, Bootstrap, Angular JS, Entity Framework, SQL, SharePoint and K2. The user interface for the solution would be primarily client side with some WebAPIs taking care of talking to the back end. The workflow would be in K2 BlackPearl.

The solution I was building was due to be delivered within 3 months. Not only that, we could only work on it part time and still had to do other projects, support and maintenance on the platform.

Using these technologies was a huge learning curve. I spent a lot of time watching the great content on Pluralsight and really quite enjoyed the learning. I had to overcome a number of issues including the fact that the current K2 REST APIs don’t support CORS, so I had to build an intermediary using WebAPI.

I worked on this on and off for about 2 months. All the time the deadline for delivering the project was getting ever closer. In addition, I began to realise how much code I was writing, how many components were involved, and started to worry about how other team members were going to be able to skill up and support the solution. Knowing that I was learning it because I was passionate, I had doubts that others would necessarily share my passion to the same extent. I really didn’t want to get into the situation where I was the only person in the team that could provide support and maintenance for the solution. I also wanted us to be able to deliver changes quickly as the need arose.

A new financial year

After quite a lot of evaluation and with the advent of a new financial year and budget, we decided to purchase K2 SmartForms. One of the things I really liked about the SmartForms solution was that it ran outside of SharePoint. Much as I love SharePoint, being able to abstract the design and execution of the forms to somewhere else, but still integrate with the SharePoint platform as needed was an attractive proposition. This fits in well with potential cloud based solutions for the future.

At this point I evaluated the amount of work remaining on the project using the other technologies and came to the conclusion that the sensible thing was to get SmartForms deployed into our infrastructure as quickly as possible and have a go at using that to build the solution. Whilst I really did like what I was doing with Angular JS etc, I decided that the benefit of the rest of our team being able to maintain and support the solution outweighed the reasons to continue.

Round One

I watched some of the material on K2 University and had a go at building the solution using SmartForms, SmartObjects and Workflow over a period of about eight business days. I was already impressed with how much of the solution I had built in that time with absolutely no code.

Then I worked with a K2 Consultant for an hour to see if I was on the right track. As it happened there were a number of techniques which could be used to make the solution much more elegant so I spent the next week rebuilding it. Whilst a little tedious, it helped to reinforce how to use the tools.

Round Two

Having implemented nearly all of the requested features in an incredibly short space of time, I presented to the stakeholders and got some feedback. They seemed happy with the functionality but a bit disappointed with the way the user interface looked. So now it was time to learn how to build a custom theme and make the forms more attractive.

I laughed when the K2 consultant suggested I hand over the design to our CSS developer. Being a very small team, I ‘handed’ the design to myself and began working through the CSS in Visual Studio.

Using some corporate colours and fonts I ended up with a fairly respectable look and feel and again showed it to the stakeholders. They seemed much happier so we decided to schedule a presentation to the team of people who would be using the solution.

Requirements and scope

In some ways, this process has reminded me a lot of the years when I built Lotus Notes solutions in a very agile fashion. (Now that was a product ahead of its time in my opinion….)

Whilst presenting to the team, new requirements surfaced that had not been identified in previous workshops. I was quite amazed that although the changes were of some substance, I completed them in a matter of about seven working hours.

I couldn’t help but wonder how long it would have taken me if I was making those changes to my custom Angular JS based solution.

Conclusion (so far)

I have genuinely been blown away with how much functionality I have been able to build in such a short period of time with no code at all. This was reinforced by how quickly I was able to make changes to the solution.

During the project, I have been able to use the K2 Package and Deployment tools to deploy between development, staging and production environment. It hasn’t been 100% smooth sailing, but I have been able to overcome any issues I have encountered so far. Generally I am pretty happy with this part of the toolset.

I am still working on a couple of technical infrastructure issues with the K2 support team, but I am sure we’ll sort that out.

In the mean time, I have already built two other solutions with SmartForms to do document approvals in SharePoint libraries. I’ll admit I did write a bit of JavaScript for those ones, but only for the SharePoint custom actions to call the SmartForms to then start the workflow. (We are still on SharePoint 2010)

There is genuine excitement among team members about the possibilities for SmartForms and we are running training for the whole team in October. I believe we will be able to deliver high quality consistent solutions in pretty short time frames and I am looking forward to seeing how things progress over the next six months.

I have transitioned from ‘sceptic’ to ‘convert’ when it comes to SmartForms. Congratulations to the K2 team on creating a really useful product.

The challenge of configuring SharePoint 2013 for Apps

I am in the process of configuring new SharePoint 2013 farms in preparation to move from SharePoint 2010 to SharePoint 2013. I also have K2 BlackPearl and K2 Smartforms (which is brilliant and I shall post separately about).

I need to get the App stuff configured in order to use the new K2 for SharePoint.

I did quite a bit of research on this subject and it is quite complex and there is a lot of material available on the web. I have to admit it has taken several days to get this configured to a point where it seems to be working.

These are some of the posts I referred to;

However, these did not really give me all of the answers I needed. I think I have finally worked it out so I will share some points that helped me.

My scenario is that I have multiple SharePoint web applications which use host headers. I followed the guidance and created new ‘app’ domains for dev, staging and production rather than using sub-domains. These are just entries in our internal DNS for now. Unless we start publishing apps outside the firewall, there doesn’t seem to be any point in registering those domains externally. We generated wild card certificates for each of those domains from our Active Directory infrastructure.

Because I have two wild card certificates, one for SSL for my SharePoint web applications and one for the new App domain, I had to create a second IP address for each of my web front end servers. The DNS was configured so the new domains pointed at the second IP address. (I have seen some posts that Windows Server 2012 has some new capability to use a single IP address, but 2 addresses seemed simpler.)

Then I had to create a SharePoint web app on port 80 with no host header as per Jeremy Thakes post;

Some people have written posts about needing a root site collection to get it to work. However, it wasn’t clear where this needed to be created. In my case, the default SharePoint web app on port 80 does NOT seem to require a root site collection. The web apps that you are deploying to DO require a root site collection. (Because I have not yet restored my 2010 databases, I only had a dummy site collection which was not at the root.)

Then I started getting certificate errors. So now in IIS manager I changed the bindings on the SharePoint Default port 80 web site. I changed this so that ports 80 and 443 both bound to the second IP address and configured the SSL certificate to be the one generated for the apps.

Now I can publish a simple App from Visual Studio 2013 and it loads without errors.

In summary;

  • Create two IP addresses on the WFE, one for SharePoint and one for Apps
  • Configure DNS for the new domain you created for Apps to point to the second IP address on the WFE.
  • Create separate wildcard SSL certificates for SharePoint and for Apps.
  • Create a ‘Default’ SharePoint web application using port 80 and no host headers. (No need to configure it with Alternate Access Mappings to support SSL. No need for a site collection.)
  • In IIS Manager change the bindings for the ‘Default’ SharePoint web site to bind to the IP address designated for the apps. Assign the app wild card certificate to the https entry.
  • Bind the https entry for all of the other SharePoint web sites to the other wild card certificate.
  • Follow the guidance from various other sources to do the App configuration (starting the services, creating the service application etc)
  • Try publishing an app from the template in Visual Studio 2013 and see if it renders correctly and all SSL connections work without errors.



It wouldn’t surprise me if this is not the end of the story. However, I hope this might help someone else get to some of the answers more quickly than I did.