Building Dynamic Strings in SharePoint Designer Workflows

A few people have asked if it is possible to create a SharePoint Designer workflow variable that includes references to other variables. Indeed, it is possible.

The Build Dynamic String action in the Workflow Designer allows you to define any combination of static text, list field data, and workflow data in a single variable. When you click dynamic string for this action, you can look up values as needed in the String Builder dialog box, as shown here when creating a meeting request message.

To look up the value of another workflow variable, change the Source list value to Workflow Data and select the appropriate item from the Field list. In this example, the workflow already has a MeetingRequestDate variable that will be used in the dynamic string.

After you define the string value, click Variable: variable and then click Create a new variable to provide a new variable name.

It should be noted that these dynamic strings cannot be referenced when creating a task with the Assign a To-do Item action. Lookups are not allowed in the Name or Description fields of the Custom Task Wizard. However, you can reference dynamic strings when using the Send an Email action. Lookups can be performed in the To, CC, Subject, and message body fields of the Define E-mail Message dialog box.

16 thoughts on “Building Dynamic Strings in SharePoint Designer Workflows

  1. Hi, Ralph.

    Yes, you can use the Do Calculation action to save formula output to a variable. Then, you can look up that variable in the Build Dynamic String action.

    Hope this helps…


  2. Hi, Rob.

    I would use a combination of InfoPath and SharePoint Designer for your scenario. Within the InfoPath form template, you could include button controls that set “send” data source fields based on specific email groups. InfoPath has a simple data connection wizard that allows you to pull data (e.g., with Web services) from external sources. Then, in the SharePoint Designer workflow, you could include an action to send an email message using the “send” data source fields from the InfoPath form.

    Hope this helps…


  3. I have to find the maximum date from my data rows (Date field).this search will be conditional as “where empId=10” is it possible…..

  4. Hi, Dinesh.SharePoint Designer workflows do not have a built-in function that allows you to iterate through rows in a list to find maximum values. Instead, you will need a Visual Studio workflow to find a maximum value…Regards,David

  5. Hi,a question related to dynamical data into a workflow you might answer.In a custom list in sharepoint, I have a field named “Contributors” with the type “people or group” and allowing multiple values.I want to build a workflow that automatically send an email to all the people listed in the field “Contributors” as soon as a new item of the list is created of modified.I guess that it could help many people :-)Any ideas ?Many thanks

  6. Hi, Hermann.If you allow multiple selections for a “People or Group” column, then you will not be able to look up the value of that column in the To field of an SPD workflow email message. Instead, you will need to store your email addresses in a different column (e.g., a “Single line of text” column) and then do a lookup for that column.Regards,David

  7. How could I build a string using the value of a field (i.e., “Value1 – 111”) and just return the “Value1” portion but add it to another string “SSS” to make “SSS-Value1″thanksBR

  8. Hi, Bruce.Unfortunately, there are no substring capabilities in SharePoint Designer workflows, so you cannot pull Value1 out of an existing string value. Unless Value1 is stored in its entirety in another column, then you would need a Visual Studio workflow to get your desired functionality.Regards,David

  9. I have a multi-choice column (via checkboxes) in a list. When a user updates this item, is there a way to calculate a value for whether they have checked an additional box or whether they have unchecked a box?

  10. Hi, David.You can use the “contains” operator in your workflow logic to identify multiple values in a single column. In other words, you could create conditions such as “If Column1 contains X and Column1 contains Y…”.Hope this helps…Regards,David

  11. Thanks for the response David, but I don’t think that I explained my scenario well enough. Let me give you a little bit more in-depth analysis and then maybe you can point me in the right direction.I have a very simple two column list that contains only one item. This single item is then modified by the entire team. The first column is “Consultant Out”, which is a multi-choice checkbox field. The other column is “Notes”, which is a single line of text.When a consultant is going to be out of the office, they edit the item and click the checkbox next to their name. They can also enter notes such as “Mike on vacation 1/13”, etc. The workflow then kicks in and sends an email to the entire team. Currently, the trigger on the workflow is that if no check box is checked – no email is sent. However, if two consultants have their name checked at the same time and one of them then returns to the office and updates the item by unchecking their name… the workflow sends an email to the team because there is still data in this field (which is the other checkbox for the consultant that is still out).What I would like to be able to do is have the workflow only send an email to the team when a checkbox is being checked and avoid sending emails when somebody unchecks a box. Does this make sense? If so, do you know if this is even possible with SharePoint Designer?

  12. Hi, David.A SharePoint Designer workflow cannot track version data on a single column, so it will not detect that a single check box in a choice column has been cleared by a user. For your scenario to work with SharePoint Designer, you would need an additional yes/no “Notify Team” column that would determine if the email message is sent or not.Regards,David

  13. I added the “Notify Team” column, which works great. However, I would like the default to always be set to yes and this is giving me trouble.I have set a condition that checks to see if Notify is set to yes, if so it will then email the team. However, if they have chosen no I want to reset the Notify variable back to yes and then end the workflow so that the Notify team radio button will be on yes next time they edit. The problem I am having is that as soon as the workflow changes it to yes, the email condition is then met and an email is sent after all.I would have thought that the else/if statement would prevent the workflow from repeating after the change, but it appears that the flow is firing a second time.Any ideas on how to prevent this and/or another way of solving this issue? Please remember that users are editing and re-editing a single entry in a list. So the solution given on this page does not solve my problem… you for your continuing help David!

Comments are closed.