holding a glowing earth globe in his hands

Creating a Knowledge Base Site – Part IV

May 20, 2011
Comments off

Back for another installment of the Knowledge base site I’ve been putting together, now we’re on to Part IV, setting up the wiki for the site. Let’s just have a quick recap on the previous parts:

  • Part I – Creating the tables needed for the Document library and the workflow to create new sections if required
  • Part II – Adding validation to the list form field so that the user could not select both an existing section and also add a new one.
  • Part III – Adding in JavaScript code to add multiple tags into the tags table without duplicating existing ones using a web service call to the database

Part IV is going to be quite brief. We’re going to create the Wiki list and then you’re going to need to follow the same instructions from Part II and Part III to add the code in the correct places to do the same job. I’ll point out when and where as we go along. Firstly lets get a custom list built to the following specifications:

Table Design

Field Name Field Type
Name Single Line of Text
Wiki Content Multiple lines of Text
Category Lookup – Set the lookup to the Categories table
New Category Single Line of Text
Tags Single Line of Text


So, as you can see we have a new custom list which has a lot in common with the Document Library we created back in Part I. Now what we need to do is create another workflow, this workflow is going to be very similiar to the one we created for the document library but the main difference is that it will not require the validation that the description be completed because we’re going to be adding the category information in before we create the list item (as opposed to the document library where the file is uploaded first).

Workflow Design

Step 1: Open SharePoint Designer and then open the site which you have created.

Step 2: Create a new Workflow and attached the workflow to the Wiki list. Also select the workflow to automatically start when a new item is created and when an item is changed. As shown below:


Step 3: Add a condition which checks if New Category is not empty.

Step 4: Now we’re going set up the actions for the new category. The first action is to create a new list item is the Categories list. Take a look at the screenshot below, easy enough to follow.

Step 5: Once the new category list item has been created we need to update the current item, moving the value from New Category to Category. This is essentially done by setting Category to the object created in the previous action and then set New Section to blank.

Save and compile the workflow and that’s the first part of the wiki list completed. The next step is to add the JavaScript into the NewForm.aspx file and the EditForm.aspx for the list so that the the category validation is in place. This is detailed in Part II but as it is quite a simple process here’s what you need.

Validation JavaScript

Assuming that you Wiki List is called Wiki then the files should be in the following location:


Follow the process below for each of the files:
Right click on the file and Check Out the document and then open it. Now follow the steps like so:

  1. Select the Split view so that you can see both code and the visual representation
  2. On the visual representation click on the List Form Webpart, this will highlight the code that corresponds to this
  3. Scroll the code until you’re at the bottom of the highlighted code.
  4. On the code, directly after the closing WebPartPages:WebPartZone bracket add a couple of blank spaces.
  5. Add the following JavaScript
  6. Save the file
  7. Return to the Wiki list from the internet browser and add a new item.

The last step is to add in the JavaScript to add tags to the site.  This is what the JavaScript will do:

  1. The code will take the value stored in the tags field and create an array based of values using “;” as an indicator that the next index needs to be started
  2. Once the array is created the code will loop through each index and query the database to check if the String value in the index exists as a tag in the Tags list.
  3. If the String doesn’t exist then a soap request will be used to create a new list item for that tag, essentially adding the tag to the Tags list

You will need to take a look at Part III for details on adding this code as it is far too detailed to repeat on this post.

Now you should have a site containing the following:

  • A document Library with Category validation and checks for tags and adds new items, if required, to the tags list
  • A Wiki custom list with Category validation and checks for tags and adds new items, if required, to the tags list
  • A workflow associated with the document Library which creates new categories if required
  • A workflow associated with the wiki which creates new categories if required
  • A Categories list
  • A Tags List

The next step is going to be to create the visual aspect for the user interface, part V coming very soon…..

Comments are closed.