SharePoint Designer 2013 workflow to concatenate strings
Learn how you can use the String Builder in SharePoint Designer 2013 to concatenate two or more strings with each other.
SharePoint Designer workflows do not offer a concat function you can use to concatenate two or more strings with each other within a workflow, but you want to still be able to concatenate two or more strings with each other.
You can use SharePoint workflow variables and the String Builder dialog box in SharePoint Designer 2013 to be able to perform string concatenation.
In this example, you are going to concatenate the string that is stored in a variable with the string that is the value of a field of a SharePoint list item.
To perform string concatenation in a SharePoint Designer 2013 workflow:
- In SharePoint 2013, create a new SharePoint list named MyList that has one column named Title.
- In SharePoint Designer 2013, create a new List Workflow that runs on the MyList SharePoint list. Name the workflow ConcatenateStringsWF and leave SharePoint 2013 Workflow selected as the Platform Type.
- Create a local variable of type String named TextString1.
- Add a Set Workflow Variable action to the SharePoint workflow, and configure it to say:
Set Variable: TextString1 to 1
- Add a Log to History List action to the SharePoint workflow.
- Click message in the sentence for the workflow action, and then click the ellipsis (...) button behind the text box that appears.
- On the String Builder dialog box, click Add or Change Lookup.
- On the Lookup for String dialog box, leave Current Item selected in the Data source drop-down list box, select Title from the Field from source drop-down list box, and click OK.
- On the String Builder dialog box, type an underscore ( _ ) immediately after the text that is present in the Name text box, and then click Add or Change Lookup.
- On the Lookup for String dialog box, select Workflow Variables and Parameters from the Data source drop-down list box, select Variable: TextString1 from the Field from source drop-down list box, leave As String selected in the Return field as drop-down list box, and click OK. The final expression in the Name text box on the String Builder dialog box should now say:
[%Current Item:Title%]_[%Variable: TextString1%]
- On the String Builder dialog box, click OK.
- End the SharePoint workflow with a Go to a stage action.
- Configure the SharePoint workflow to start automatically when an item is created.
- Publish the workflow to SharePoint 2013.
In SharePoint 2013, navigate to the MyList SharePoint list and add a new item. Once the workflow has run and completed, navigate to the workflow history list, and verify that a _1 was appended to whatever text string you entered into the Title field of the SharePoint list item.
In the solution described above, you learned how to use the String Builder dialog box in SharePoint Designer 2013 to concatenate the string stored in a variable to a string stored in a field of a SharePoint list item.
You can use the String Builder dialog box this way to concatenate any amount of strings you want. The strings you concatenate can be static strings (like the underscore you typed into the Name text box) or strings that are dynamically retrieved from a data source such as the Current Item data source, the Workflow Variables and Parameters data source, the Workflow Context data source, another SharePoint list, etc.
- Create a simple SharePoint Designer 2013 workflow
- Create a SharePoint Designer 2013 reusable workflow
- SharePoint Designer 2013 workflow to propercase strings
- Use SharePoint Designer 2013 workflow variables to get day of week
- How to perform date calculations and construct dynamic strings in a SharePoint Designer workflow