cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jp17
New Member

Formatting for a compose output

I think I'm missing something that feels like it should be simple.

 

I have a Flow that's going out and getting group membership. Once it does, I'm selecting a few fields from those members and then using compose, with the output from my select step as the input for my compose step. When I put that output in an email, it formats like the following:

 

[{"Value1":"Value2"},{"Value1":"Value2"}]

 

I'd like to at the very least be able to have each record display on a separate line. If there's a way to remove the output formatting, that would be nice too. So something more like:

 

Value1 - Value2

Value1 - Value2

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @jp17,

 

Could you please share a screenshot of your flow's configuration?

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "List group members" action, specify Group Id.
  • Add a "Select" action, From set to output of "List group members" action, within Map entry, enter one entry. The key set to Display Name and the corresponding value set to Display Name dynamic content of "List group members" action.
  • Add a "Compose" action, Input set to output of "Select" action.
  • Add a Variables-> "Initialize variable" action, Name set to FinalString, Type set to String and Value set to empty.
  • Add a "Apply to each" action, input parameter set to output of "Compose" action.
  • Within "Apply to each" action, add a "Compose 2" action, Inputs set to following formula:
string(item())

Add a "Compose 3" action, Inputs set to following formula:

indexOf(outputs('Compose_2'),':')

Add a "Compose 4" action, Inputs set to following formula:

indexOf(outputs('Compose_2'),'}')

Add a "Compose 5" action, Inputs set to following formula:

substring(outputs('Compose_2'),2,sub(outputs('Compose_3'),3))

Add a "Compose 6" action, Inputs set to following formula:

substring(outputs('Compose_2'),add(outputs('Compose_3'),2),sub(sub(outputs('Compose_4'),1),add(outputs('Compose_3'),2)))

Add a "Compose 7" action, Inputs set to following formula:

concat(outputs('Compose_5'),' - ',outputs('Compose_6'))

Add a "Compose 8" action, Inputs set to following formula:5.JPG

Note: Within Inputs field, fill the output of "Compose 7" action in first line, then fill the FinalString variable in the second line.

 

Add a "Set variable" action, Name choose FinalString and Value set to output of "Compose 8" action.

 

  • Under "Apply to each", add a "Send an email" action, Body field set to FinalString variable.

 

The output of the "Compose" action as below:12.JPG

Image reference:6.JPG

 

7.JPG

 

8.JPG

 

9.JPG

The flow works successfully as below:10.JPG

 

11.JPG

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xida-msft
Community Support
Community Support

Hi @jp17,

 

Could you please share a screenshot of your flow's configuration?

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "List group members" action, specify Group Id.
  • Add a "Select" action, From set to output of "List group members" action, within Map entry, enter one entry. The key set to Display Name and the corresponding value set to Display Name dynamic content of "List group members" action.
  • Add a "Compose" action, Input set to output of "Select" action.
  • Add a Variables-> "Initialize variable" action, Name set to FinalString, Type set to String and Value set to empty.
  • Add a "Apply to each" action, input parameter set to output of "Compose" action.
  • Within "Apply to each" action, add a "Compose 2" action, Inputs set to following formula:
string(item())

Add a "Compose 3" action, Inputs set to following formula:

indexOf(outputs('Compose_2'),':')

Add a "Compose 4" action, Inputs set to following formula:

indexOf(outputs('Compose_2'),'}')

Add a "Compose 5" action, Inputs set to following formula:

substring(outputs('Compose_2'),2,sub(outputs('Compose_3'),3))

Add a "Compose 6" action, Inputs set to following formula:

substring(outputs('Compose_2'),add(outputs('Compose_3'),2),sub(sub(outputs('Compose_4'),1),add(outputs('Compose_3'),2)))

Add a "Compose 7" action, Inputs set to following formula:

concat(outputs('Compose_5'),' - ',outputs('Compose_6'))

Add a "Compose 8" action, Inputs set to following formula:5.JPG

Note: Within Inputs field, fill the output of "Compose 7" action in first line, then fill the FinalString variable in the second line.

 

Add a "Set variable" action, Name choose FinalString and Value set to output of "Compose 8" action.

 

  • Under "Apply to each", add a "Send an email" action, Body field set to FinalString variable.

 

The output of the "Compose" action as below:12.JPG

Image reference:6.JPG

 

7.JPG

 

8.JPG

 

9.JPG

The flow works successfully as below:10.JPG

 

11.JPG

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

To get each  field on a separate line I add this expression between each field:

concat(' ','</br>')

 

 

Anonymous
Not applicable

How can you get this working for a multipart list into something plain text format? This would have worked great when I sent as email but now that I'm working in planner the format is all over the place and only works on the first part of the entry.

image.pngHello thanks for your post

but am getting error .. Please help me understand why this is happening

 

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.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (5,085)