Last Friday I wrote about how I had come up against a serious bug in SharePoint Workflow when creating a new record in a SharePoint Wiki. Yes, just another example of how underwhelming SharePoint's touted wiki functionality when compared to products like SocialText or Confluence. Since last weekend I have persevered and today actually succeeded in implementing a Template functionality in the SharePoint Wiki. It required two workflows to be developed in SharePoint Designer 2007 and a couple of extra fields to be defined in the wiki. The result is crude but somewhat effective. This is what I had to do... I created two extra fields in the Wiki Library:
CopyTo - a single line text field
MakeTemplate - A Yes/No field that defaults to No. I then created two workflows. The first workflow works manually or when a record in the Wiki is changed.The second workflow works manually or when a record is created. The Change Workflow does the following: - Check for MakeTemplate = Yes and CopyTo is not blank
- Copy the Record to a New Record in the Same Wiki (You have to use Copy because the Create Record functionality is broken for Wikis. It creates a stub file that you can't edit)
- Clear the CopyTo field back to blank The action of Copying the record to a new record triggers the second Workflow that looks for records being created. The Create Workflow does the following: - Check for MakeTemplate set to Yes and CopyTo is not blank
- Set Name field (ie. Title of the Page) to CopyTo value
- Set MakeTemplate to No and CopyTo value to blank
This scenario allows a user to create a new page from any page that has the MakeTemplate field set to Yes.
Creating from the Template involves filling out the CopyTo field and saving the template record. The advantage of this is that it leaves a version history that documents who created a new page from the template and what the page was called. The next refinement is to work out if it is possible for the workflow to update the browser leaving the user on the new page. In the absence of this capability I have modified the Home Page of the Wiki to add a Web Part that lists the three most recent pages changes made by the User. What I haven't worked out how to do - since I am only a lowly site administrator and not a SharePoint Server Administrator, is how to change the layout of the New Wiki and EditForm pages for the Wiki. Changing these files away from the default for the site collection seems to disable the Edit button on the Wiki. Making the Wiki largely useless. Yet more examples of how SharePoint is not a Collaboration platform but rather a development platform. ....It shouldn't be this hard to collaborate.
The fact that SharePoint is missing an out of the box ability to work with multiple templates in a Wiki is not much short of scandalous for an Enterprise class product in 2009.