cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LC1Ama
Helper I
Helper I

Apply to each doesn't recognize my array - thinks it's of string type?? - HELP -

I'm building a flow to take my Form input and populate it to a SP List.

One of the Form questions is a multi-select choice for regions: APAC, LATAM, NORAM, NECSE, WEMEA, GLOBAL

I need to loop through the choices they select and perform some functions for the choice for each one (get emails from a table for the specific region)

 

It looks like the form input comes in fine as an array - but when I use the outputs of the get response for the form question it fails and says it's of type string and a valid array must be used.

 

I then tried cleaning the input from the Form with a compose1 function and then use a compose2 function to split the choices back into a clean array and still get the same error about it being a string and not of a valid array type...grrrrr.

 

Can't figure out why it won't accept the outputs of Compose2 as an array - what am I doing wrong?

 

GetResponses: Form question "what region can benefit from your service requirement?"

LC1Ama_0-1623311285758.png

Side note:  to me, it looks like I could just use the dynamic form question in my Apply to Each as it's already presenting as an array format no?  In any case, that was the first attempt and it ended in the same error result. Hence, after researching it seemed that perhaps I needed to compose it into a valid array so went for the compose options below and still have the error.

 

Clean up compose1 function: (basically looks like it's not needed!)

LC1Ama_3-1623311529475.png

replace(replace(replace(outputs('Get_response_details')?['body/r575ed882061248f1b4c7cfb73de19ca0'],']',''),'[',''),'"','')
 

LC1Ama_1-1623311345750.png

Compose cleanup output back into an array with compose2 function:

LC1Ama_4-1623311562018.png

split(outputs('Clean_Up_Multi_Choice_Regions'),',')

 

LC1Ama_2-1623311412853.png

 

My apply to each function that fails

 

outputs('ComposeCleanRegionArray')

LC1Ama_5-1623311611798.png

 

error when I run: 

LC1Ama_6-1623312003952.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
jinivthakkar
Resident Rockstar
Resident Rockstar

@LC1Ama It should work, I tried and worked fine for me 

jinivthakkar_0-1623314104761.png

just remove the for each and add it again.

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
jinivthakkar
Resident Rockstar
Resident Rockstar

@LC1Ama It should work, I tried and worked fine for me 

jinivthakkar_0-1623314104761.png

just remove the for each and add it again.

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

LC1Ama
Helper I
Helper I

OMG - seriously?? I have been working on this for 2 days.  I deleted the Apply to Each and re-added it back again from scratch and it works now.  Sometimes I just HATE flow..... grrrr.   Thanks for pointing out an obvious troubleshooting solution that I should have thought of trying.  All works like a charm now! 

jinivthakkar
Resident Rockstar
Resident Rockstar

@LC1Ama please can you accept my reply as answer, thanks !

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,156)