rcoketrs8
Nintex Newbie

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

Jump to solution

It no longer hangs, as you said I mentioned RelatedContent and didn't actually configure that variable. Now it works in the sense of it emails me with the information I want from the variables. However it sends the same correct information 112 times instead of once. It is working better than before. Haha.

Regarding the index variable the config for that was done at the "For Each Action". I linked the variable to a number.

Index config

0 Kudos
Reply
emha
Automation Master
Automation Master

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

Jump to solution

I guess after previous exercise you have already moved sent notification action out of the loop...

then it looks like you have listed yourself 112 times in a notification addressee list (collection?) and you have configured the action to send individual emails.

so either clean the addressee list and remove duplicates or switch off sending individual emails.

0 Kudos
Reply
rcoketrs8
Nintex Newbie

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

Jump to solution

Yep, the email notification action was moved out o f the loop.

I am only listed once within the email notification and I de-selected the option to send individually. I have deleted the notification action and re-added it however it doesn't make any difference. It is quite the mystery! I can't think of anything that would be causing this at this point.

0 Kudos
Reply
emha
Automation Master
Automation Master

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

Jump to solution

don't you have any outer loop in workflow that may execute these set of actions repeatedly?

need not be right a loop action itself, might be as well a state machine if you go down the same branch several times.

are you sure (all the) notifications caome from the actual/latest workflow instance. can't they be sent by a previous instance(s)?

how do you start the workflow?

is it list or site workflow?

0 Kudos
Reply
rcoketrs8
Nintex Newbie

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

Jump to solution

Nope, no outer loop now. I have included an image of the full workflow so you can see it in its entirety after the various changes.


Based on the amount of the emails they are coming from the workflow I run at that moment in time. I always receive 112 in a short period of time. I don't think that they are overlapping and in any case in order to receive that many emails I would have had to run the workflow around 40 times if it only ever sent out 3 emails each time.

I start the workflow via a PowerShell command. This is a list workflow connected to a workflow task list.

 

0 Kudos
Reply
emha
Automation Master
Automation Master

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

Jump to solution

I start the workflow via a PowerShell command

don't you start it by any chance on each item in the list?

(or at least on some 112 items?)

0 Kudos
Reply
rcoketrs8
Nintex Newbie

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

Jump to solution

Nope, I can't do that in this situation. The goal is to supply a weekly report so triggering this via a added item wouldn't really work. I plan to run the PowerShell command via a scheduled task every week.

0 Kudos
Reply
emha
Automation Master
Automation Master

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

Jump to solution

could you share the ps script?

I have a bad feeling that it, maybe unintentionally, runs for each list item.

if you want to schedule workflow, you should have created a site workflow. you wouldn't need a ps script at all.

View solution in original post

Reply
rcoketrs8
Nintex Newbie

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

Jump to solution

You were right. I didn't even think about the script being the problem! I created  a site workflow in my live environment and test that. It seemed to have worked as it should to an extent. The information within the email wasn't generated however I can work on that.

Here was he code I was using to start the workflow. I would run on each item causing that problem gahhhhhhhhh! Thank you for all of your help.

$web = Get-SPWeb -Identity http://sharepoint/siteurl

$manager = $web.Site.WorkFlowManager

$list = $web.Lists["Task listn ame"]

$assoc = $list.WorkflowAssociations.GetAssociationByName("Outstanding Decom Tasks","en-US")

$data = $assoc.AssociationData

$items = $list.Items

foreach($item in $items)

{$wf = $manager.StartWorkFlow($item,$assoc,$data,$true)}

$manager.Dispose()
$web.Dispose()

Reply