cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JenLavery
Frequent Visitor

Help! Trouble with 'For Each' following 'Switch' checker and Array woes

Hi all, I'm trying to trigger an Approvals process from MS Form, then (following approval) update the response spreadsheet with the outcome and comments.  The Forms to Approvals part is working great, the problem is when doing a 'For Each' after that to take it to the spreadsheet, it's failing because I have 3 different branches of Approval in the switch, and it seems I'll need an array for each item I need to make it work (Outcome, Responses Approval name, Completion Time, Comments).

 

JenLavery_0-1620405659291.png

 

JenLavery_0-1620658148055.png

 

 

I've tried inserting a Scope module in between the Switch and For Each functions and trying to put an array together.  Problem is I'm a coding noob, and can't seem to make it work.  I've made arrays based on the outputs from each Switch branch to the following effect:

 

 

or(or(or(
equals(outputs('Send_for_approval_to_Director_BCI_and_wait_for_response')?['body/responses']),
equals(outputs('Send_for_approval_to_Director_ECS_and_wait_for_response')?['body/responses']),
equals(outputs(outputs('Send_for_approval_to_Director_ECS_and_wait_for_response')?['body/outcome']))))

 

 

I've also tried the switch function after following an article that was given as a response to another user, set out as pictured:

JenLavery_1-1620658274295.png

 

 

The 'For Each' function still insists on nesting, and I'm not sure if that's what it should do in this case?  Should I change to an If function?

 

Currently I'm stuck with the prospect of doing an individual entry down every branch of the switch, which isn't ideal.  Can anyone help me with this?

1 REPLY 1
JenLavery
Frequent Visitor

I've updated the original post with where I am, still haven't resolved this issue.  Any insights would be appreciated.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,055)