In Part 1 of this post I discussed the possible options to obtain a document URL for a document in the document library. With this post I will explain how you can achieve this with a simple workflow.
In your document library create a column “Encoded URL” (Single line of text). It will be used to store URL later on. In your document library versioning settings you must set option to require checking out items. This is very important step. The workflow we are going to create will be fired every time document is modified. Since workflow will modify item, if we do not require checking out, workflow might end up in an infinite loop. Without checking out workflow might result in very confusing errors informing you that someone else modified your document that it cannot be saved and similar.
To create a workflow you will need program called Microsoft Office Sharepoint Designer (FrontPage successor). Here is what you need to do:
1. Open your SharePoint site with SharePoint designer
2. Choose New > Workflow
3. For workflow start options choose:
a. Automatically start this workflow when a new item is created
b. Automatically start this workflow whenever an item is changed
4. Create only a single step for your workflow and
a. For step condition choose “Compare Documents field” and set it as on figure below
b. Add tree actions (as shown below)
i. Check out item
ii. Set value for encoded URL column
iii. Check in item
5. Save your workflow
When completed your document library will look like this one (document URL is shown in Encoded URL column):