cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Julien2
Kudo Kingpin
Kudo Kingpin

PowerApps: Upload images to SharePoint with the related ReportID

Hello everyone!

I have a SharePoint library which will be used to upload the images from PowerApps.
The app is about creating a report,add some expenses lineitems to the report,taking bills photos of the selected report, and on submit the flow will upload the images to the library.
I have created in my library a column called "PictureReportID", which it should trigger the selected report id in PowerApps.
When the user submit the lineitem the image will be uploaded, and it should update the column "PictureReportID" in the library to the id of the existing report in my list.
So i can know each image is related to which report id in my library.

I have created the flow i get the error in the filter query where i am saying that:

 

ID eq @{triggerBody()['Getitems_FilterQuery']}.

 

In PowerApps i didn't get any error on my save button and the function of my button is the following:

 

Set(FileLinkFromFlow, Powerapps.Run(TextInput2.Text & ".jpg", Dropdown1.Selected.Value, TakenPic, SelectedReport.ID).filelink)

 

Here is my flow:

Capture2.PNGFlow FailFlow Fail

What i am doing wrong ? Can someone please explain, in details, and provide examples ?

Any help will be greatly appreciated
Thank you!

18 REPLIES 18
Jay-Encodian
Community Champion
Community Champion

Hey @Julien2

It'd be helpful to see the actual filter query that is being sent in the query:

1.PNG

That said... if you are querying using an ID... which is unique, the query (if working correctly) would only return a single item... and if so, it would be simpler to use the 'Get Item' action and not the 'Get Items' action... That way your query for a single item by its ID and you don't need to use an OData filter query.

If I've misunderstood please share the sent query data 🙂

HTH

Jay

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

v-alzhan-msft
Community Support
Community Support

Hi @Julien2 ,

 

Please add single quotes to the dynamic content in the Filter Query field.

1.png

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-alzhan-msft  and @Jay-Encodian ,

 

I have added single quotes to the filter query field, but now the problem is in the flow is not updating the "PictureReportID" column to the report id in my other list which the image is related to. The query is not returning the value of the report id.

Here is the run history of the flow:

Capture1.PNG

Thank you!

Hey @Julien2 

Reference to my previous question; can you confirm why you're using 'Get items' and not 'Get Item'? If you're querying a list to get items by an ID... it will only ever return a single item.

I could see the single quotes issue with the query... but I still don't think you should be using that action.

Am I missing something?

HTH

Jay

 

 

Hi @Jay-Encodian ,

Sorry i didn't know that Get Item action was available, so now i just figure it out. I removed 'Get items' action and i have added the Get item action and i got different error which is the following:

GetItem.PNGReportID.PNG
The flow error said that the Item was not found since the item already exist in my other list so what am doing wrong?

Thanks for your help!

Hey @Julien2 ,

The 'ID' field is a standard field which exists on every list / library item... looks like you've created another ID column labelled 'ReportID'... i.e. the 'Get Item' action is querying a different column.

If I've understood this correctly you're trying to add some pictures to a SharePoint library and associate the uploaded files to a specific entry in the 'LineItems' list? If so, you need to do something like:

1) Pass the 'LineItem' report ID to Flow

2) Upload the file using the 'Create File' SharePoint action

3) Use the 'Update File Properties' SharePoint action to set the columns as required to associate the newly added file(s) to your line items

See below for simple example:

1.png

HTH

Jay

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @Jay-Encodian ,

I will explain in details what i am trying to do.
Yes that's right i have 2 different lists LineItems and Expenses the type of my ReportID column is Lookup which get the information from Expense list to get the id of the report.
In PowerApps i have created a screen to take some pictures and upload the images to SharePoint library using the flow on the save button.
I have added a column called "PictureReportID" for the flow update the ID of the LineItem in this column so i can know each image is related to which report id.

Now after testing back the flow, it seems that i have a problem with the function on save action where the button is not getting the related id of the LineItem and the function is below:

Set(SelectedReport,Powerapps.Run(TextInput2.Text & ".jpg", Dropdown1.Selected.Value, TakenPic, LookUp(Expenses,ID=SelectedReport.ID)))

Now the flow is not running because i have problem with the function.

Capture5.PNG

Here is the updated flow:

Capture6.PNG
So what would be my function to get the Selected LineItem ?

 

Thank you!

Hey @Julien2 

I'll be honest 🙂 - I'm finding incredibly difficult to decipher how you've configured your SharePoint lists and how they interact.

I think you've stated the following, that you have two lists and a document library?

  • LineItems (List)
  • Expenses (List)
  • Pictures (Document Library) - Store images captured via PowerApps

It's not clear what the LineItems and Expenses list do an why you are linking via a lookup column... can you explain what each list does and why you have opted for the configuration you have applied?

A few questions:

  • Does the expenses list contain an expenses submissions, which has a 'one to many' relationship with the 'LineItems' list and 'Pictures' list?
  • Does a image file in the 'Pictures' list have a 'one to one' relationship with the an item in the 'LineItems' list

Thanks Jay

Hi @Jay-Encodian ,

I am using the Expense Report app from template in PowerApps and i've followed the installation instruction from the documentation over here:

Expense Report Insall 

I am linking the ID of the item in the Expense List to the Report ID column in LineItems. So when the user create a report he can add to the report different LineItems so i can know in my LineItem list the items that are related to the Report ID in the Expense List.
Considering your questions, this app does not include to take pictures and upload them to the library so i have customized the app to take different pictures and upload them to Pictures (Document Lib).
The created report has one to many relationship with the LineItems so the user can add multiple LineItems to the same Report.

Question 2 Answer: I expect that regarding this question here is the problem because when i take the picture and save it to the library the taken picture is not triggered by the selected LineItem ID.

 

Thanks for your help!

Hey @Julien2 

Thanks, that really helped.

So, the app is already configured to store each expense submission in the expenses list and it uses the ID column of each expenses item to associate the items in the 'LineItems' list using the ID of the expenses item... this is done by creating a lookup column in the 'ListItems' list called 'ReportID'.

In essence you should follow this same model;

  1. Add a 'ReportID' column to the 'Pictures' library where you are storing images which is a lookup to Expenses list 'ID' field (As pet the 'ReportID' column in the 'LineItems' list.
  2. Configure your PowerApp to pass the Expense item ID field to your Flow
  3. Add another column to your 'Pictures' library called 'LineItemId', which is a lookup to the individual 'LineItem' Id to which the image is associated with.
  4. Configure your PowerApp to pass the Lineitem item ID field to your Flow
  5. Use the SharePoint 'Create File' action to add the file SharePoint
  6. Use the SharePoint 'Update File Properties' action to set the 'ReportID' and 'LineItemId' fields with the relevant data

This will ensure each image can be associated to both the expense report and the contained line items...

Assuming this all makes sense... have you been able to configure your PowerApp to align the image taken to a specific line item ID... so you can pass the data to Flow?

HTH

Jay

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

Hi @Jay-Encodian 

I have followed your steps, but i have a problem with the formulas bar to configure the ID of the selected LineItem. (I will just use LineItems ID without the expenses id because i am uploading the images only in the case of adding new lineitem)
The function i am thinking about is the following but i got an error:

Set(FileLinkFromFlow,SelectedLineItem, Powerapps.Run(TextInput2.Text & ".jpg", Dropdown1.Selected.Value, TakenPic, LookUp(LineItems,ID=SelectedLineItem.ID)).filelink)

Capture6.PNG

Considering the flow i set the LineItemId to `Update files properties that is asked from powerapps`.

Capture5.PNG
We are very close to solve this issue but i still have problem with configuring my app to align the image taken to a specific line item id.

Thank you very much for your help!

Hey @Julien2 

I think you need to do two things

  • Remove and then re-add the Flow association... this will force PowerApps to pickup the new parameter configuration that the Flow is expecting.
  • Ensure that any value your passing to the SharePoint actions ID fields are sent as numbers... to do this you may need to wrap the parameter in a value() expression, example below;

1.png

HTH

Jay

Hi @Jay-Encodian 

 

Yes every time i modify the flow, i re-add it back to the button to enter the expression of the new parameter.
But the issue is on ID parameter (The user don't have any access to access to the Expeneses/LineItems list in SharePoint, only he can use the app) so i don't have field to let the user put the reportID, i want the flow to trigger the selected lineitem id and update the column in the library.

Capture10.PNG

 

Thank you!

Hey @Julien2 

But the app is adding to data to SharePoint... so either you've shared the connection or the users will be prompted to create connections on first use of the app. If its the latter then the users would have to have access to the lists to read /add data.

If you're PowerApp is adding list items associated to a report then you must hold the at least the reportId in the powerApp... you could use this to get all of the related line items and then the target LineItem ID... but it really does depend on how you have configured the app and order of execution. I'll try to mock this up... but it will take some time.

As a thought; Do you have to add the pictures to a separate list? could you not add the images as an attachement to the LineItem item on add? reference - https://powerapps.microsoft.com/en-us/blog/add-attachments-to-sharepoint-lists/ 

HTH

Jay

 

Hi @Jay-Encodian 

You're right but for example i want to make the app later on only everyone can see his own Expenses so user1 can't see the expenses of user2.

That's the problem, i want the screen that contain the camera control hold the ReportID of the related LineItem id.
I've followed this tutorial to create and manage the camera control in the Expense Report app.
Upload an image to SharePoint using Flow 

I've tried also to use Attachments in my form it works well but i really want to solve this problem.
Take your time Jay no problem i really appreciate your support, i want to do my best to solve this issue.

 

Thank you!

Hi @Julien2 

Sorry, it's taken a little longer than hoped to get back to this...

Ref security; you'll need to configure the lists 'item level permissions' via advanced settings as follows:

1.png

 

Ref associating the line item / report item ID to the picture... have you now resolved that issue?

HTH

Jay

 

Hi @Jay-Encodian 

 

No problem, unfortunately i am still stuck in this issue. However,I have enabled in LineItem list the options of item level permission you mentioned which will trigger the user that he created the item in the list.
But the main problem is in PowerApps where the action of the save button should trigger the selected LineItem in the app,pass it to the flow,and update the ID of the lineitem column in the library.

 

Thank you!

Hi @Julien2 

Ok, we may be going over old ground here... but lets consider a few things.

The items are linked by SharePoint item ID's which are assigned when a new item is added to a list, a new document added to a document library.

i.e. the ID assigned to the expense report and the ID's assigned to each LineItem item aren't created until after the data has been added to SharePoint.

So.... if PowerApps is creating the data directly (i.e. not Flow) then you'll need to add the picture when the item itself is created, similar to: https://powerapps.microsoft.com/en-us/blog/add-attachments-to-sharepoint-lists/

Seems there are issues adding the attachment via a patch (i.e. add the attachment to the list item after is has been created):  https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Need-to-add-Attachment-to-a-PATCH-t...

If you want to add to separate library then you;ll need to obtain the item ID's after the items have been created: https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Get-the-last-ID-of-Sharepoint-list-... 

And then configure PowerApps to add the document to SharePoint setting passing both the file and ID to Flow... this may be of interest: https://www.youtube.com/watch?v=kQVYid1p_vA

HTH

Jay

Helpful resources

Announcements

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT).     This is an incredible opportunity to connect with members of the Copilot Studio product team and ask them anything about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendars now because you will not want to miss the conversation.   This live event will give you the unique opportunity to learn more about Copilot Studio plans, where we’ll focus, and get insight into upcoming features. We’re looking forward to hearing from the community, so bring your questions!   TO GET ACCESS TO THIS EXCLUSIVE AMA: Kudo this post to reserve your spot! Reserve your spot now by kudoing this post.  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today.   Invitations will be sent on April 2nd.Users posting Kudos after April 2nd at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendars for April 3, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Unlocking Community Achievements and Earning Badges

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!     THIS WEEK'S TIP: Unlocking Achievements and Earning BadgesAcross the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. These badges each signify a different achievement--and all of those achievements are available to any Community member! If you're a seasoned pro or just getting started, you too can earn badges for the great work you do. Check out some details on Community badges below--and find out more in the detailed link at the end of the article!       A Diverse Range of Badges to Collect The badges you can earn in the Community cover a wide array of activities, including: Kudos Received: Acknowledges the number of times a user’s post has been appreciated with a “Kudo.”Kudos Given: Highlights the user’s generosity in recognizing others’ contributions.Topics Created: Tracks the number of discussions initiated by a user.Solutions Provided: Celebrates the instances where a user’s response is marked as the correct solution.Reply: Counts the number of times a user has engaged with community discussions.Blog Contributor: Honors those who contribute valuable content and are invited to write for the community blog.       A Community Evolving Together Badges are not only a great way to recognize outstanding contributions of our amazing Community members--they are also a way to continue fostering a collaborative and supportive environment. As you continue to share your knowledge and assist each other these badges serve as a visual representation of your valuable contributions.   Find out more about badges in these Community Support pages in each Community: All About Community Badges - Power Apps CommunityAll About Community Badges - Power Automate CommunityAll About Community Badges - Copilot Studio CommunityAll About Community Badges - Power Pages Community

Tuesday Tips: Powering Up Your Community Profile

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week's Tip: Power Up Your Profile!  🚀 It's where every Community member gets their start, and it's essential that you keep it updated! Your Community User Profile is how you're able to get messages, post solutions, ask questions--and as you rank up, it's where your badges will appear and how you'll be known when you start blogging in the Community Blog. Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile.     Password Puzzles? No Problem! Find out how to sync your Azure AD password with your community account, ensuring a seamless sign-in. No separate passwords to remember! Job Jumps & Email Swaps Changed jobs? Got a new email? Fear not! You'll find out how to link your shiny new email to your existing community account, keeping your contributions and connections intact. Username Uncertainties Unraveled Picking the perfect username is crucial--and sometimes the original choice you signed up with doesn't fit as well as you may have thought. There's a quick way to request an update here--but remember, your username is your community identity, so choose wisely. "Need Admin Approval" Warning Window? If you see this error message while using the community, don't worry. A simple process will help you get where you need to go. If you still need assistance, find out how to contact your Community Support team. Whatever you're looking for, when it comes to your profile, the Community Account Support Knowledge Base article is your treasure trove of tips as you navigate the nuances of your Community Profile. It’s the ultimate resource for keeping your digital identity in tip-top shape while engaging with the Power Platform Community. So, dive in and power up your profile today!  💪🚀   Community Account Support | Power Apps Community Account Support | Power AutomateCommunity Account Support | Copilot Studio  Community Account Support | Power Pages

Super User of the Month | Chris Piasecki

In our 2nd installment of this new ongoing feature in the Community, we're thrilled to announce that Chris Piasecki is our Super User of the Month for March 2024. If you've been in the Community for a while, we're sure you've seen a comment or marked one of Chris' helpful tips as a solution--he's been a Super User for SEVEN consecutive seasons!   Since authoring his first reply in April 2020 to his most recent achievement organizing the Canadian Power Platform Summit this month, Chris has helped countless Community members with his insights and expertise. In addition to being a Super User, Chris is also a User Group leader, Microsoft MVP, and a featured speaker at the Microsoft Power Platform Conference. His contributions to the new SUIT program, along with his joyous personality and willingness to jump in and help so many members has made Chris a fixture in the Power Platform Community.   When Chris isn't authoring solutions or organizing events, he's actively leading Piasecki Consulting, specializing in solution architecture, integration, DevOps, and more--helping clients discover how to strategize and implement Microsoft's technology platforms. We are grateful for Chris' insightful help in the Community and look forward to even more amazing milestones as he continues to assist so many with his great tips, solutions--always with a smile and a great sense of humor.You can find Chris in the Community and on LinkedIn. Thanks for being such a SUPER user, Chris! 💪 🌠  

Tuesday Tips: Community Ranks and YOU

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!This Week: Community Ranks--Moving from "Member" to "Community Champion"   Have you ever wondered how your fellow community members ascend the ranks within our community? What sets apart an Advocate from a Helper, or a Solution Sage from a Community Champion? In today’s #TuesdayTip, we’re unveiling the secrets and sharing tips to help YOU elevate your ranking—and why it matters to our vibrant communities. Community ranks serve as a window into a member’s role and activity. They celebrate your accomplishments and reveal whether someone has been actively contributing and assisting others. For instance, a Super User is someone who has been exceptionally helpful and engaged. Some ranks even come with special permissions, especially those related to community management. As you actively participate—whether by creating new topics, providing solutions, or earning kudos—your rank can climb. Each time you achieve a new rank, you’ll receive an email notification. Look out for the icon and rank name displayed next to your username—it’s a badge of honor! Fun fact: Your Community Engagement Team keeps an eye on these ranks, recognizing the most passionate and active community members. So shine brightly with valuable content, and you might just earn well-deserved recognition! Where can you see someone’s rank? When viewing a post, you’ll find a member’s rank to the left of their name.Click on a username to explore their profile, where their rank is prominently displayed. What about the ranks themselves? New members start as New Members, progressing to Regular Visitors, and then Frequent Visitors.Beyond that, we have a categorized system: Kudo Ranks: Earned through kudos (teal icons).Post Ranks: Based on your posts (purple icons).Solution Ranks: Reflecting your solutions (green icons).Combo Ranks: These orange icons combine kudos, solutions, and posts. The top ranks have unique names, making your journey even more exciting! So dive in, collect those kudos, share solutions, and let’s see how high you can rank!  🌟 🚀   Check out the Using the Community boards in each of the communities for more helpful information!  Power Apps, Power Automate, Copilot Studio & Power Pages

Find Out What Makes Super Users So Super

We know many of you visit the Power Platform Communities to ask questions and receive answers. But do you know that many of our best answers and solutions come from Community members who are super active, helping anyone who needs a little help getting unstuck with Business Applications products? We call these dedicated Community members Super Users because they are the real heroes in the Community, willing to jump in whenever they can to help! Maybe you've encountered them yourself and they've solved some of your biggest questions. Have you ever wondered, "Why?"We interviewed several of our Super Users to understand what drives them to help in the Community--and discover the difference it has made in their lives as well! Take a look in our gallery today: What Motivates a Super User? - Power Platform Community (microsoft.com)

Users online (5,608)