I have this Gallery and a tab sitting on top of the gallery. This tab has a file upload control that I stole from a form in another screen. I did this because I am using the file upload control function to upload a file and trigger a flow in automate that uploads the file with meta to a sharepoint directory.
This is in my file control OnAddFile:
fileUpload.Run(Project.ID,{file:{contentBytes: Last(DataCardValue89_1.Attachments).Value, name: Last(DataCardValue89_1.Attachments).Name}});
Refresh('PSI - DIRECTORY');
Reset(DataCardValue89_1);
The file upload works fine, but the gallery does not refresh to show the new file. However, If I add another file the same way right after this, it will show the first uploaded file and not the current file I am trying to upload. The same behavior keeps going every time I upload a file, the previous one shows up. So it's not refreshing real time.
The gallery is fetching directly from data source with this:
Filter('PSI - DIRECTORY', fk_projects = Project.ID)
I've read somewhere someone fixed this by doing the refresh and reset of the form. But this isn't a form since I just took the file upload control only and did the functionality with automate.
Any ideas?
@charlessexton
wait, sorry the button thing did work. So I'm thinking you are correct, it just needs a little time. But adding automate to a var didn't do the trick
@charlessexton
I also added an extra button with the following to click after file upload and still not working
Reset(DataCardValue89_1);
Refresh('PSI - DIRECTORY')
@charlessexton thanks for the reply. I didn't think of it that way. It did not look to have worked however.
here is what I changed according to your comments
UpdateContext({ discard: fileUpload.Run(Project.ID,{file:{contentBytes: Last(DataCardValue89_1.Attachments).Value, name: Last(DataCardValue89_1.Attachments).Name}}) });
Reset(DataCardValue89_1);
Refresh('PSI - DIRECTORY')
Your Power Automate flow might not have finished by the time you're refreshing the data source. If you assigned the result of the flow to a variable, it will force it to complete before processing the next bit of code.
UpdateContext({ discard: fileUpload.Run(Project.ID,{file:{contentBytes: Last(DataCardValue89_1.Attachments).Value })
WarrenBelz
146,552
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,928
Most Valuable Professional