SharePoint Online -Nintex Workflow - Properly Display The Email Address From Filter Collection

Introduction

 
In this article we will be exploring how to display the email address value via Nintex workflow using office 365 in SharePoint online.
 

Problem

 
We have created a list name - Information. In this list, we have created 3 columns namely, Title, City and Email. The Data in the information list as set up as below.
 
SharePoint Online - Properly Display The Email Address From Filter Collection
 
We have another list called Email. It has a lookup column “City”, whenever an item is added to this list, an email is triggered to all the email ids assigned to this Email column from Information list. So, whenever an item Is added to the Email list, an email will be sent to the address selected in the city lookup column. Currently, we get the output as below.
 
 
Here the data is returned; i.e. the email address is not separated by a semicolon delimiter.
 

Solution

 
To fix this we will be using Regular expression action in our Nintex workflow.
 
Note
We will be achieving this without using any loops.
 
Step 1
 
Assign the current “City” column value to a workflow variable. Here I have used “City” as a variable.
 
Step 2
 
Here the Query List pulls all the records in the table, but we want the record for the Filter data based on city so we will be choosing “Select items only when the following is true”
 
SharePoint Online - Properly Display The Email Address From Filter Collection
 
We will be retrieving this using City variable from Step 1.
 
SharePoint Online - Properly Display The Email Address From Filter Collection
 
Based on City filter, we will assign Email column value. We are selecting “Email” column as the email addresses are stored in this column. We are storing all the email addresses based on the city in a collection.
 
Here is what the collection looks like, ["[email protected]","[email protected]","[email protected]","[email protected]"]
 
Steps 3
 
Next, we will use the Regular Expression Action and configure the fields as below.
 
In this step we must replace the “[“” with a blank. So, String operation field will be “Replace” and the Pattern to replace will be “[[“]”. The output of this value will be stored in a variable of type TEXT and we have named that variable as varRegStateFirst. Since we are going to replace “[”” with a blank, the Replacement String field will be empty. Click save.
 
SharePoint Online - Properly Display The Email Address From Filter Collection
 
Step 4
 
Next, we will use another Regular Expression Action and configure the fields as below.
 
In this step we must replace the “]” with a blank. So, String operation field will be “Replace” and the Pattern to replace will be “[]]”. The output of this value will be stored in a variable of type TEXT and we have named that variable as varRegStateSecond. Since we are going to replace “]” with a blank, the Replacement String field will be empty. Click save
 
SharePoint Online - Properly Display The Email Address From Filter Collection
 
Step 5
 
Next, we will use another Regular Expression Action and configure the fields as below. 
 
In this step we must replace the “,” with a “;”. So, String operation field will be “Replace” and the Pattern to replace will be “[,]”. The output of this value will be stored in a variable of type TEXT and we have named that variable as varRegStateFinal. Since we are going to replace “[,]” with”;”, the Replacement String field will be”;”. Click save
 
SharePoint Online - Properly Display The Email Address From Filter Collection
 
Step 6
 
Drag the Send an email action to the point in the workflow where you want to send an email and configure the action. Use the varStateFinal in the “To” field and click save.
 
The resulting output will be as follows,