Create Shortened (‘TinyURL’) links from your SharePoint Workflow – Part 2

Posted at: 13:22 on 18 February 2010 by Muhimbi

workflow Not too long ago we wrote about how to create a Short URL from a SharePoint workflow using the Muhimbi URL Shortener (MuSH) in combination with our Workflow Power Pack. The response from our customers has been so positive that we decided to ship a Workflow Action with the new version of MuSH.

For those not familiar with the product, the Muhimbi URL Shortener for SharePoint, aka MuSH, can be used to shorten URLs for typical web applications and SharePoint in particular. It integrates tightly with both WSS and MOSS and allows short URLs to be created directly from a list item’s context menu, workflows and web services. For details see the original product announcement.

Creating short URLs from a workflow can be very useful. For example creating a short URL named after data in an InfoPath form or create a short URL for a deeply nested folder. In the example below we create a short URL that always points to the latest entry in the announcement list. Not sure if this is useful, but it illustrates the power of this facility.

Create the workflow as follows:

  1. Download and install the Muhimbi URL Shortener for SharePoint.
  2. Make sure you have the appropriate privileges to create workflows on a site collection.
  3. Create a new workflow using SharePoint Designer.
  4. On the Workflow Definition screen associate the workflow with the Announcements list, tick the box next to ‘Automatically start this workflow when a new item is created’ and proceed to the next screen.
  5. From the Actions Menu select Create Short URL, you may need to click More Actions first.
  6. The following Workflow Sentence is inserted:

  7. To auto generate the short URL, leave the optional short name empty, but in our case we always want to give it the same name, so enter Announce.
  8. Click this ID / address, click the Workflow Lookup button and select Current Item as the Source and ID as the field.
  9. Click Document / Display Form and select Document (when used in a Document Library) or Display Form showing the item’s properties. As we are not dealing with a Document Library, it doesn’t matter what is selected.
  10. Click Overwrite / Return null and select the Overwrite as we always want to write the latest announcement using the same short name. (Return Null will return null in the output variable, which can then be tested for and action can be taken accordingly.)
  11. Click Variable: this variable and specify the variable the Short URL will be stored in. In this example name it shortURL.
  12. Add a Log To History List Action and specify the name of the workflow variable the Short URL has been stored in using the Workflow Lookup dialog box.

Close the workflow and create a new Announcement. When the workflow has finished, click the completed link to see the output. Click the generated URL to link to the latest announcement.

Create another Announcement, the Short URL should now link to the latest announcement.


Labels: , , , ,


  • Thank you, Expert. Great intro to SharePoint workflow.

    SharePoint Designer deploys workflows as XML and compiles it on-the-fly. What’s the implication of this in terms of performance? Will the same workflow created by Visual Studio perform better because it’s compiled into assemblies and deployed in the GAC? Is there a pre-compiling and caching mechanism for SharePoint Designer workflows similar to how execution plans are generated for SQL Server stored procedures?

    By Anonymous Jordon Lewis, At 16 March, 2010 23:06  

  • Hi Jordon,

    Although I have no hard figures to back me up, I have personally witnessed a (very) small delay the first time a workflow is executed. Subsequent invocations are very fast and, depending on the actual content, execute almost instantaneously.

    By Blogger Muhimbi, At 17 March, 2010 09:03  

Post a Comment

Subscribe to Post Comments [Atom]

Subscribe to News feed