I have a customfield_12858 that is a multi-user picker field. I want to send one email per day to each user that is selected in cf[12858], and the email should contain a list of all the work items on which that user is selected in cf[12858]. There should not be any emails sent to multiple users at the same time, even if the multiple users are selected in cf[12858] on the same work item.
I've tried about a million tweaks but cannot get it just right. The following automation is sending me two emails:
1. 1 with a list of the 3 work items on which I'm selected in cf[12858], which is good.
2. 1 to me and another user who are both selected in cf[12858] on one work item, but the email doesn't even list the 1 work item. This email should not be sent at all.
Please see detailed screenshots of the current automation rule, email output, and audit log, and thanks in advance.
Hi @Stewart_ Emily _ Global D_T
When the rule uses Lookup Work Items on a multiple-selection, user field, that produces a list of lists. Thus when the distinct function is added, it is checking the sets of selections.
For example, if you had four work items with these user selections:
The result of {{lookupIssues.customfield_12858.distinct}} would be [Alice, Bob], [Bob], [Eve]
When you want the individual user selections to be distinct, all the nested lists need to be flattened into one list before distinct is used:
{{lookupIssues.customfield_12858.flatten.distinct}}
Please try that and let me know how it helps.
Also, you note this in your question:
There should not be any emails sent to multiple users at the same time, even if the multiple users are selected in cf[12858] on the same work item.
Would you please clarify what you mean by "at the same time"?
Kind regards,
Bill
Hi Bill, thanks so much for your prompt and accurate response. It worked as far as I can tell. I'll need to confirm with a couple more people tomorrow but feel confident the word flatten did the trick. Regarding my last comment, I just meant I didn't want an email to be sent to more than one user, so flattening worked perfectly. Thanks again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.