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

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
Helper V
Helper V

@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 V
Helper V

@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 V
Helper V

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,443)