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
Dual Super User
Dual 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
Dual Super User
Dual 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
Dual Super User
Dual 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
Dual Super User
Dual 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
Dual Super User
Dual 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
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.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (3,767)