Create Shortened (‘TinyURL’) links from your SharePoint Workflow – Part 2
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:
-
Download and install the Muhimbi URL Shortener for SharePoint.
-
Make sure you have the appropriate privileges to create workflows on a site collection.
-
Create a new workflow using SharePoint Designer.
-
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.
-
From the Actions Menu select Create Short URL, you may need to click More Actions first.
-
The following Workflow Sentence is inserted:
-
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.
-
Click this ID / address, click the Workflow Lookup button and select Current Item as the Source and ID as the field.
-
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.
-
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.)
-
Click Variable: this variable and specify the variable the Short URL will be stored in. In this example name it shortURL.
-
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.
Clavin is a Microsoft Business Applications MVP who supports 1,000+ high-level enterprise customers with challenges related to PDF conversion in combination with SharePoint on-premises Office 365, Azure, Nintex, K2, and Power Platform mostly no-code solutions.