cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Julien2
Level: Powered On

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.PNGCapture3.PNGFlow 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
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Community Support Team
Community Support Team

Re: PowerApps: Upload images to SharePoint with the related ReportID

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.

Julien2
Level: Powered On

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Jay-Encodian
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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

 

 

Julien2
Level: Powered On

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Jay-Encodian
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Julien2
Level: Powered On

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Jay-Encodian
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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

Julien2
Level: Powered On

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Jay-Encodian
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

 

Julien2
Level: Powered On

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Jay-Encodian
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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

Julien2
Level: Powered On

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Jay-Encodian
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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

 

Julien2
Level: Powered On

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Jay-Encodian
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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

 

Julien2
Level: Powered On

Re: PowerApps: Upload images to SharePoint with the related ReportID

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!

Jay-Encodian
Level 10

Re: PowerApps: Upload images to SharePoint with the related ReportID

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,651)