cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Digital
Level 8

Using ForAll to run a Flow and pass in parameters from a collection?

I want to bulk upload images by either passing a collection to flow or use ForAll to run the flow for each record.
 
Something along the lines of:
 
ForAll(
colArticleImages,
ImageUpload.Run(FileName,ImageRaw).ImageUrl
)
 
FileName and ImageRaw are columns in the colArticleImages collection.
 
I would then like to add each ImageUrl returned from flow to a collection.
 
I was wondering about the best method for achieving this and if it is even possible.
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft v-siky-msft
Microsoft

Re: Using ForAll to run a Flow and pass in parameters from a collection?

@Digital 

Could you share more details and screenshots about the flow and app?

I have made a test. bulk upload image to SP documents, and return the File ID. Hope this help.

1. check the flow steps

Snipaste_2020-01-21_11-38-56.png

2. add an Add Picture control, set OnSelect property of AddMediaButton1 as below, all JSONs with ImageName and Image are saved into the collection.

 

Collect(MyCollection,{JS:JSON({FileName:AddMediaButton1.FileName,File:UploadedImage1.Image},JSONFormat.IncludeBinaryData)})

 

3. add a button, set OnSelect as below, save the return ID into the collection.

 

ClearCollect(ReturnID,ForAll(MyCollection,SPdoc.Run(JS).fileid))

 

 Snipaste_2020-01-21_11-41-19.png

Snipaste_2020-01-21_11-45-29.png

Sik

View solution in original post

3 REPLIES 3
Highlighted
Microsoft v-siky-msft
Microsoft

Re: Using ForAll to run a Flow and pass in parameters from a collection?

@Digital 

Could you share more details and screenshots about the flow and app?

I have made a test. bulk upload image to SP documents, and return the File ID. Hope this help.

1. check the flow steps

Snipaste_2020-01-21_11-38-56.png

2. add an Add Picture control, set OnSelect property of AddMediaButton1 as below, all JSONs with ImageName and Image are saved into the collection.

 

Collect(MyCollection,{JS:JSON({FileName:AddMediaButton1.FileName,File:UploadedImage1.Image},JSONFormat.IncludeBinaryData)})

 

3. add a button, set OnSelect as below, save the return ID into the collection.

 

ClearCollect(ReturnID,ForAll(MyCollection,SPdoc.Run(JS).fileid))

 

 Snipaste_2020-01-21_11-41-19.png

Snipaste_2020-01-21_11-45-29.png

Sik

View solution in original post

Digital
Level 8

Re: Using ForAll to run a Flow and pass in parameters from a collection?

@v-siky-msft ,

 

Thank you this will be very useful. It's similar to what I've been trying but the flow was failing as it had a problem with the JSON I was sending. How did you define your JSON schema? I ran once and used the output from initialize variable step to generate from sample but Flow was complaining. I will try again using your method.

 

My PowerApp uses a gallery to display 4 AddMedia controls. These are populated if a user selects an existing record in my gallery, otherwise they display a generic image. I am also using ForAll to run flow for each image in my collection. I was hoping Flow could return JSON that I could parse into a collection in PowerApps, but I believe this isn't possible at this time.

 

Thanks again, I'll mark your answer as the accepted solution. 

 

 

Microsoft v-siky-msft
Microsoft

Re: Using ForAll to run a Flow and pass in parameters from a collection?

@Digital 

My JSON schema as follows

{
    "type": "object",
    "properties": {
        "File": {
            "type": "string"
        },
        "FileName": {
            "type": "string"
        }
    }
}

It is generated from the sample:

{"File":"Test",
"FileName":"Test"}
Sik

 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,142)