cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rhamza
Super User
Super User

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

rhamza
Super User
Super User

@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
Super User
Super User

@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
Super User
Super User

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
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,667)