cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rhamza
Helper III
Helper III

Contact Email into 1 string

Hello folks,

 

I have a sharepoint list called client and one called contact. The client has a lookup into contact with multiple values.

 

When there is a problem that arise, I want to send an email to all these contact.

 

1. Get Items

2. Select

 

Result : 

 

[
  [
    {
      "@odata.type""#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
      "Id"2,
      "Value""Bob@construct.com"
    },
    {
      "@odata.type""#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
      "Id"1,
      "Value""Carrey@price.com"
    }
  ]
]
 
Problem, how do I display ONLY the VALUE : Carrey@price.com and Bob@construct.com ?
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @rhamza

 

Ignore my first reply. I missed the part of that you are using a multi select field, my bad 😁

 

In that case you can use the approach which is nicely described by @tom_riha:

https://tomriha.com/how-to-convert-array-to-a-string-in-power-automate/

 

1. In the Select action use the follow expression for your Map field.

 

item()?['Value']

 

 

itemvalueselect.png

 

 

2. Use a compose to join the email values into one string

 

join(body('Select'),';')

 

 

 joinbodyselect.png

View solution in original post

7 REPLIES 7
Expiscornovus
Super User
Super User

Hi @rhamza,

 

In an apply to each that would be the fieldname/Value. For example my field is called Contact.

items('Apply_to_each')?['Contact/Value']

 contactvalue.png

Expiscornovus
Super User
Super User

Hi @rhamza

 

Ignore my first reply. I missed the part of that you are using a multi select field, my bad 😁

 

In that case you can use the approach which is nicely described by @tom_riha:

https://tomriha.com/how-to-convert-array-to-a-string-in-power-automate/

 

1. In the Select action use the follow expression for your Map field.

 

item()?['Value']

 

 

itemvalueselect.png

 

 

2. Use a compose to join the email values into one string

 

join(body('Select'),';')

 

 

 joinbodyselect.png

View solution in original post

rhamza
Helper III
Helper III

@Expiscornovus 

 

1st Thx for your reply, for me This returns "Null"

 

This is because it is inside the following : 

 

item()?['Contact_x003a_Email']
 
And when I do this : 

item()?['Contact_x003a_Email']?['Value']
 
This error come along : 
 
The execution of template action 'Select' failed: The evaluation of 'query' action 'where' expression '@item()?['Contact_x003a_Email']?['Value']' failed: 'The template language expression 'item()?['Contact_x003a_Email']?['Value']' cannot be evaluated because property 'Value' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.
Expiscornovus
Super User
Super User

Hi @rhamza,

 

Have you selected the Contact field in the From field of the Select action?

 

If so, you only would need to reference the value of the item in the Map field, which would be:

 

item()?['Value']

 

 

Btw, can you share some screenshots of your current setup?

 

 

rhamza
Helper III
Helper III

@Expiscornovus 

 

We're getting further! 

 

rhamza_0-1621004663119.png

 

But the join do not seem to work.

 

rhamza_1-1621004705714.png

 

I need bob@construct.com;carrey@price.com 

Expiscornovus
Super User
Super User

Hi @rhamza,

 

Can you place your compose action within the apply to each loop?

rhamza
Helper III
Helper III

Dammit... it works! Good job mate.

 

My understanding of Apply to each was wrong. I thought apply to each was running on contact email but it is actually running on the Get Items and then selecting the contact email

 

Thx bud !

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,177)