Convert strings to uppercase or lowercase in a SharePoint Designer 2013 workflow

Learn how you can make a string uppercase or lowercase in a SharePoint Designer 2013 workflow.

ADVERTISEMENTS

Problem

SharePoint Designer workflows do not offer an uppercase function or a lowercase function you can use to convert the characters that are contained within a string into uppercase or lowercase characters, but you still want to be able to change letters in a string to capitals or small letters via a workflow.

Solution

You can use SharePoint workflow variables, the SharePoint Designer workflow loop structure, and the String Builder dialog box in SharePoint Designer 2013 to be able to convert a string to uppercase or lowercase in a workflow.

The solution described here makes use of a technique to loop through all of the characters in a string that was discussed in a previous article combined with a basic technique that was explained in SharePoint Designer 2013 workflow to propercase strings.

In this example, you are going to convert the string that is stored in a field of a SharePoint list item to uppercase. The conversion to lowercase is similar to the conversion to uppercase with the difference of going from capitals to small letters.

To convert a string to uppercase in a SharePoint Designer 2013 workflow:

  1. In SharePoint 2013, create a new SharePoint list named MyList that has one column named Title.
  2. In SharePoint Designer 2013, create a new List Workflow that runs on the MyList SharePoint list. Name the workflow UpperCaseStringWF and leave SharePoint 2013 Workflow selected as the Platform Type.
  3. Follow steps 3 through 6 of SharePoint Designer 2013 workflow to propercase strings.
  4. Follow steps 3 through 11 of SharePoint Designer 2013 workflow loop through characters of a string.
  5. Create a local variable of type String named uppercased.
  6. Click below the Log to History List workflow action within the loop to place the cursor.
  7. Add a Find Substring in String action to the SharePoint workflow, and configure it to say:

    then Find Variable: substring in Variable: loweralphabet (Output to Variable: index1 )
  8. Add an If-condition to the workflow that says:

    If Variable: index1 not equals -1
  9. Within the If-condition block, add an Extract Substring of String from Index with Length action to the SharePoint workflow, and configure it to say:

    Copy from Variable: upperalphabet , starting at Variable: index1 for 1 characters (Output to Variable: substring1 )
  10. Within the If-condition block, add a Set Workflow Variable action to the SharePoint workflow, and configure it to say:

    then Set Variable: substring to Variable: substring1
  11. Just below and outside of the If-condition block, add a Set Workflow Variable action to the SharePoint workflow, and configure it to say:

    then Set Variable: uppercased to [%Variable: uppercased%][%Variable: s...
    where you must use the String Builder dialog box to construct a string that makes use of the uppercased and substring workflow variables and that says:

    [%Variable: uppercased%][%Variable: substring%]
  12. Click to place the cursor just below and outside of the loop, and then add an If-condition to the workflow that says:

    If Variable: uppercased is not empty
  13. Within the if-condition block, add an Update List Item action to the SharePoint workflow, and configure it to say:

    Update item in Current Item
    where you must set the value of the Title field to be equal to the value of the uppercased workflow variable.
  14. End the SharePoint workflow with a Go to a stage action.
  15. Configure the SharePoint workflow to start automatically when an item is created.
  16. Publish the workflow to SharePoint 2013.

In SharePoint 2013, navigate to the MyList SharePoint list and add a new item that has its Title field set to for example this is just a test. Once the workflow has run and completed, the text THIS IS JUST A TEST should appear in the Title field of the SharePoint list item.

To convert a string to lowercase, you must switch around the use of the upperalphabet and loweralphabet variables.

Related Articles

ADVERTISEMENTS