You are viewing limited content. For full access, please sign in.

Question

Question

Is there a way to limit search results in workflow to only return a distinct value, or loop through a For Each Entry of an activity for distinct values, or only retrieve distinct values?

asked on April 17, 2014

I'm creating this workflow to send each responsible employee a list of the accounts they are responsible for resolving that have been outstanding more than 30 days.  The email looks great because after retrieving the User ID from the first search, it is used to loop through results of a second search that is specific to their User ID; however, the same email is being sent to the same user for each entry in the search result containing their User ID.  If there are 12 entries in the results of the first search containing their user ID, they will receive the same email 12 times.  I don't want to obtain the User IDs from an Active Directory group because they're not configured yet, and some of the entries are for terminated employees.  Is there a way to do one of the following?:

 

Limit the results of the first search to only show the first entry for each user

Only loop through the search results once for each user

Only retrieve distinct field values from the search

 

Thank you!

Workflow.JPG
Workflow.JPG (31.41 KB)
0 0

Answer

SELECTED ANSWER
replied on April 17, 2014 Show version history

It sounds like that will work.  After the second Assign Token Values activity, do I need another For Each Entry activity or For Each Value activity?

0 0
replied on April 17, 2014

Yes. Then you'll want to foreach over the new list of values.

 

Your first foreach will only collect the initial set of values, and the second one will pretty much be the same as what you've got in your screenshot.

0 0

Replies

replied on April 17, 2014

You could have the Determine Users loop add each user ID to a multi-value token. Then after you have the list of user ID's (with possible duplicates) you can assign that list to another token and apply a Remove Duplicates Token Function as part of the assignment.

 

2 0
replied on April 18, 2014

That was the trick.  You are awesome!!! Thanks for your help Devin!  Attached is the finished product for anyone's future refrence.

Workflow.JPG
Workflow.JPG (37.41 KB)
0 0
replied on April 18, 2014

This might be too late, but if you use business processes, the Workflow Server can take care of collecting that data for you and sending out notifications.

0 0
replied on April 18, 2014 Show version history

We're not using Business Processes yet, but hopefully soon. smiley

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.