Friday 27 May 2011

Case conversion in SharePoint workflows

Strangely there are no options when using SPD to convert case even though you can convert case easily using a calculated column in your list or library.

There is a workaround that you can use.

First create a list with a calculated column to hold the result of converting a column to upper or lower case. Use =UPPER(Title) or =LOWER(Title) depending on your preference.

Then use the list in any workflow that you need to do a case conversion. Here is a screen of a workflow that does just that. In this example I am setting both upper and lowercase from the same list, i.e. I have two calculated fields in my case conversion list.



You will notice that after creating the list item in the case conversion list, that I immediately make a copy of it. This is because the calculated field event will not fire until something is done to force it. In this case we use the copy item option.

Note that it is the new copy of the item that has the converted data in it not the first item so you must remember to use this to retrieve the data. Hence the use of ‘plus 1’ in the workflow.

The last two lines just delete the two list items that the workflow created to perform the conversion. This is not required but it is just good practice to tidy after yourself.