My app allows a manager to assign a ticket to multiple staff members using a people picker, however, we want to be able to store the assigned staff member's email addresses in a plain text string in order for it to work well with a couple of flows we run later down the line.
I had tried to create a collection OnChange and then concat the email columns of the collection but have been having trouble with removing items from the collection if they are removed from the people picker, or if a second staff member is assigned in a different session than the first, then the first appeared to drop off the collection too.
I also had a problem that I had set a 'DefaultSelectedItems' to the assigned user in certain situations eg. a certain task is selected therefore it is automatically assigned to the expert in that field, but the defaultselecteditems property didn't seem to trigger the OnChange meaning the email address was not added to the collection/string.
Is there any way to collect the email addresses from the people picker both on a manual change and a default selection?
At the moment I have changed the dropdown to a basic combobox where the manager just picks out email addresses from the list, but I find it much more aesthetic and user friendly to choose/display names rather than emails!
Any help is appreciated.
Glad we managed to lead you to the solution together with @zmansuri 🙂
Have a good day
I'm not sure actually...though I had it working previously and I was sure I used Email then so I had assumed that wasn't the problem.
I managed to use this code in the plaintext label in the end and it is working fine. I think this is what Zmansuri had meant in the first place but I hadn't understood properly.
Concat(DataCardValue10.SelectedItems, Email, "; ") & Label11.Text
Your ClearCollect function assigns
Name: DisplayName
EmailAddress: Email
but the initial list in the taskdpd only has those fields: @Anonymous.type, Claims, DisplayName
Naturally, in the collection you have values for DisplayName, but not the e-mails, since there's no Email field, or?..
Thanks for your response. I have gone back and tried to do this today but my collection does not seem to be getting the email address at all now?
Code of taskdpd is:
ClearCollect(Assigned, {Name: DataCardValue10.SelectedItems.DisplayName, EmailAddress: DataCardValue10.SelectedItems.Email})
DataCardValue10 is the peoplepicker which has the default:
And my collection ends up looking like this:
The DataCard TicketAssignedToName I have tried both:
Concat(Assigned.EmailAddress, "; ")
and as you suggested:
Concat(DataCardValue10.SelectedItems, Email, "; ")
The former ends up just showing the semi-colon and the latter returns empty. It just seems Email isn't collecting at all?
Not sure what I'm doing wrong here!
@misc For the purpose of easily adding and removing from the Collection, it would be better to store the emails as separate records without concatenating them. You can always concatenate them before sending it to a Flow.
OnChange will get triggered only when a change is manually made (In some strange occasions it does get triggered when the Default value changes but it is not designed to work like that. So, don't rely on that).
To add the email based on some other change you can add it to the collection in the same place where the other change is made.
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,077
Most Valuable Professional