cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
UniKev
Level: Powered On

Sending approval request to recipients held in a json array

I'm trying to build an approvals flow which is driven from json sent to a message bus.

One of the elements of the json is an array of email addresses e.g.

"approverEmail":["a123@bangor.ac.uk","b480@bangor.ac.uk"]

 

and the flow is set up as follows

 
 

 

image.png

 

The condition at the bottom of the flow just sends a different version of an email for approve or Reject

The problem I'm having is that even though I've set the approval type to be first to respond, the flow won't complete until all approvers have responded.

 

I think the issue is that I have the approval within the Apply to All loop so rather than sending a single approval to, say, two recipients it's creating two instances of the approval one for the first email address in the array and one for the second.

 

I'm really struggling to work out how to overcome this. One way which works is that rather than have an array of email addresses we could have approverEmail1, approverEmail2 etc. as individual elements in the json but this obviously restricts us to the number of approvers we initially set up.

 

I'd appreciate any suggestions on how I could proceed.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Sending approval request to recipients held in a json array

@UniKev 

I believe that you are correct in that the issue is that your approval is in a loop.  I suggest building a semicolon delimited string with all of the email addresses (ApproverEmail appears to be a collection).  Then, use the string as the "Assigned to" value. 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Sending approval request to recipients held in a json array

@UniKev 

I believe that you are correct in that the issue is that your approval is in a loop.  I suggest building a semicolon delimited string with all of the email addresses (ApproverEmail appears to be a collection).  Then, use the string as the "Assigned to" value. 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

UniKev
Level: Powered On

Re: Sending approval request to recipients held in a json array

Scott,

 

Thank you for the quick response. That's a great idea to create a semi colon delimited string. However, being almost a complete novice at this I have no idea how I would do that.

 

How do I access the individual email addresses to enable me to concatonate them in a string?

 

Thanks for any further pointers.

 

Kevin

 

 

UniKev
Level: Powered On

Re: Sending approval request to recipients held in a json array

Just had a further thought. The application that is generating the json is also under our control, so I can ask the developer to send me the email addresses as a semi colon delimited string within the json, rather than an array.

 

It will save me having to do any processing in Flow and so simplify things greatly.

 

It took your mentioning of a semi colon delimited string to trigger that thought in my head. So thank you very much.

 

Kind regards,

 

Kevin

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,966)