cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

How can I send the output of a list query action in a single email?

Jump to solution

I have successfully configured a Query List action to filter a list based on certain criteria. If I use the "Run Now" function within the action is displays the information correctly. In my case they are Assigned to and Title. I have these outputted to single line of text variables. I then have a Build string action which uses said variables and creates another single variable which I interest to an email. The issue is I get individual email notifications for all of the items on the list (112) rather than the 3 I want.

Side note, upon logging information to history throughout the process it would seem that it logs the filtered assigned to group on items that are assigned to different groups. IE - I want to only see tasks assigned to A however within the workflow of a task assigned to B it says within the log in history task that the assigned to person is in fact A which it isn't.

Labels: (2)
0 Kudos
Reply
18 Replies
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

I have these outputted to single line of text variables

you should save returned result set into collection variables. with single line text ones you will get saved just first item out of whole result set.

having it saved it collection variables you will have to setup for each loop over one of collection variables.

within the loop you will have to process single collection elements and prepare mail body.

finally, after the loop send notification with prepared content

have a look on these threads which deal with similar topic

Configuring a Workflow to send an alert when days have elapsed 

 

0 Kudos
Reply
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

I tried to add the for each loop etc however now the workflow just hangs and doesn't complete at all. I have included screen captures below.

0 Kudos
Reply
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

from a quick look I see following (possible) problems

- in query list action you ask to return a list field which's name is stored in "WorkflowLink" list field. is that really correct?

- in collection operation you reference 'Index' variable which is not initialized/populated. you have to populate value 'Index' variable with for each loop action

0 Kudos
Reply
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

You're right with the "WorkflowLink" list field. I went ahead and removed that yesterday. Regarding the Index variable, is there specific information it should be populated by? What type of variable it should be? I tried making it a number variable and then assigning the item ID to it however that didn't seem to work out well...

0 Kudos
Reply
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

it should be numeric variable.

do not assign a value to it on your own, for each loop action will take care of incrementing it with every loop iteration.

check documentation for further details

for each - https://help.nintex.com/en-US/nintex2013/help/#Workflow/RootCategory/Actions/Nintex.Workflow.ForEach... 

collection operation - https://help.nintex.com/en-US/nintex2013/help/#Workflow/RootCategory/Actions/Nintex.Workflow.Collect... 

0 Kudos
Reply
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

Thanks for the links to the documentation regarding those actions. I understand what information should be used however I still can't get it to work in the way I want it to past the query list. The Query list action works correctly and outputs the filtered results I want. It doesn't matter which variables I use in the For each/collection operation I still get emailed 112 spate emails rather than one email containing the filtered result of the query list. Grrrr

0 Kudos
Reply
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

send notification action has to be after the loop, not within the loop

within the loop just prepare mail body into a text variable. then send content of the variable in notification after the loop once all the data are collected.

Reply
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

Roger that. So I tried that and still got spammed however through further research it would seem that I would need to create collection operation tasks per item I would like to record? Now however the workflow starts and would seem to hang...I can't figure out why...However I feel I am moving forward.

{Breakdown of workflow}

Query list (Just above for each) - AssignedTo = Assign to collection variable, Title = Title Collection variable.

Foreach - title Collection variable is sent to a title text variable.

Get assigned to -  Assigned to Collection variable is sent to a Assigned to text variable.
Get related content - Related content Collection variable is sent to a Related content to text variable.

Build String -

{WorkflowVariable:EmailStringVar}


{WorkflowVariable:TitleVar}
{WorkflowVariable:AssingedToVar}
{WorkflowVariable:RelatedContentTextVar}

0 Kudos
Reply
Workflow Hero

Re: How can I send the output of a list query action in a single email?

Jump to solution

what action does workflow hang on?

do you already correctly work with index variable(s).

you don't seem/mention to populate any RelatedContent collection.

0 Kudos
Reply