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

avatar user

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (681)