Hello David Busch -
You would not be using the For Each loop action on the list, but the collection that you queried from the list.
The query filters down to the items you want to target, then loop through that collection to get the pieces you want, build out strings that you want in the email, and then put it all together in a notification.
You may want to check out Repeating section as html table in mail and look into using XSLT as it may be more of what you are thinking.
Hope this helps!
Thanks Jesse..Can yo refer me to an example of how I loop thru a collection...in the query list do I need to create 10 collection variables for my 10 columns or do I only set a collection variable for the List ID.. thx !
David B
Do I need to create multiple collection variables (12) within the query list. Or do I create 1 collection variable. Still puzzled on how the collection variable works within the query filter collection and the required loop to retrieve the pieces. If you have a URL that may show a similiar example that would be great.
After researching further can you confirm I need to do the following:
- Query Filter
- Collection Operations (I need 10 collection operations) for my 10 columns that I need for the email
- Build String
- Loop
- Notification
For the Loop is the condition where the Collection ID = ListID
You would need to create a collection variable for each.
For example, if you have a list with Title, Start Date, and End Date as your columns, and you want to query the list to get all items with a specific Start Date, you will need a collection variable for all columns you want to do something with. So, in your Query list action, you will filter the list based on your needs and grab each field need.
We do this so that if there are multiple results, we can iterate through them and do something with that data.
Once you have the collection variables, you can use a For each loop and loop through each record to get to the specific items, like so:
Here we look in the titleColl variable and store the next one (based on index) in title
For Each title we get the Start Date and End Date in the index position from the StartDateColl and EndDateColl respectively.
Now that we have the specific data from the item, we can comprise an email that is specific to an item within the list we queried:
Hope this helps!
This definitely helps. One clarification I need though is in your original post you said I did not need a For Each ? Also, mp lan is to send out one email daily to 1 person only. The email will be a dump of all items in an Active status. thanks !
Hello -
In my original post, I meant that you would not want to use a For Each loop to send the notification (like my example above). You will want to use a For Each loop to gather all your necessary variables, build your strings, and then create ONE notification after you have ran through the loop.
Sorry for the confusion, its been a long weekend!
Hope this helps!
Hello David Busch -
Yes you will need a collection variable for each column you want to get and use later, and then an "item_Variable" (what I call them ) to store the individual variables.
I went ahead and made a quick site workflow to demo the following:
- Query List
- Collection Variables (how we store the list item's details)
- For Each loop (how we get to the specific details for a specific item)
- Build a string (to use in a notification later)
- Sending a notification with ALL of the queried details
Workflow:
Workflow Variables:
Let me know how this goes for you, but you can create a new site workflow and then import my attachment to see how I hooked everything up.
Hope this helps!
Hi Jesse, I got it to work ! Thanks for your assist. 2 outstanding issues though.
1-How do I get a field to appear as a link in the document. As an example I have an Issue field which in the SharePoint list is the "linked to item" field. In short how do I get a link/URL to display in the email for the list item.
2-I have a field called Details which unfortunately in some cases is VERY detailed. Is it it possible within Nintex to do a LEFT(Field,50) so I only display the first 50 characters or so ?
Thanks..I have learned a ton in a short time period.
Hello -
Glad to hear you got it working!
As for your outstanding issues:
1. In the Notification action, you can insert a link by clicking Editing Tools > Insert > Link
It will prompt you for the address and the text to display like so:
2. Yes you can trim out the text if you want. You can use fn-SubString(text to modify, position of the first character to retrieve, number of characters to retrieve) to accomplish this. That is located in the Inline functions when you insert a reference.
I have not used PadLeft or PadRight, but I believe you would get similar results.
Hope this helps!
Make sure you mark your question as answered so others can quickly see how you did it when searching
Hi Jesse for the notification though I need each item that I retrieved from the Query Filter. In my current Workflow I am displaying all Active items for a list. Thus, if I have 5 items will the above method you explained display 5 Linked Items. Below is what I have in the email, however, these fields are a result of building a string. thx !
Issue ID
Assigned To
Status
URL/Linked Item
..................
....................
Hello -
Ok this is easy enough, just need a few more variables setup:
In you Query list action, add another field to capture (ID):
Next, add another branch in the the For Each loop (if you are running them in parallel) to get the itemID based on the index:
Next you will need to build the url (using Build string action). You will need to add in your specific list name:
{Common:WebUrl}/Lists/YOURLISTNAMEGOESHERE/editform.aspx?ID={WorkflowVariable:itemID}
Last thing to do is add it to your email string:
This will get you the URL directly to the edit form of the item. You could replace editform.aspx with dispform.aspx to have the user click into the display form for the item.
Hope this helps!
Hi All,
I am trying to do the same- send one email at the end of the week that contains all users registered for induction on a particular date.
I have managed to get the for Each loop working where I get X emails for X people registered- but I need to merge all these emails into one.
I'm guessing it's got to do with the build string action... would you mind sharing your settings for that action?
Thanks in advance.
Billie
Amendment to post: I found the answer here
https://community.nintex.com/thread/10038
Just needed to add my email string variable to the start of the build string.
Hope this helps someone.
We have a field called time keeper, how do we email distinct time keepers and also provide link to all items related to that time keeper?
Hello! Thank you for this answer, everything is explained clearly and works perfectly in my case. The only problem I have is with quering the list. On Sharepoint I have data in the format M/d/yyyy, e.g. 8/15/2017, without time. I wanted to compare it to Current Date, as in this example, however it didn't work, the query didn't give any results. In the notifications I receive I see that the data variable gives the results with time e.g. 8/15/2016 12:00 AM. It's always 12:00 AM, even though on Sharepoint it's without time (date only format). I was trying to change format of dates, both on Sharepoint and in Nintex, but it doesn't work. It seems that they cannot be compared. Any suggestions what to do? Is it a matter of some settings?
Thank you in advance.