cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IanWall
Frequent Visitor

How can I pass a variable to a SharePoint list?

Hi all,

I've created a user form in PowerApps that gathers various pieces of information, plus file attachments, for upload to a SharePoint list.  Once an item in SP is created, this then triggers a Flow. However, a slow internet connection can cause a problem in that the Flow fires before all attachments have successfully uploaded.

As part of the PA form upload, I've set a variable to the number of attachments, but this is not displayed on the form anywhere. How can I pass this to a specific field in the SP list?

All advice welcome!

Thanks,

Ian 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @IanWall ,

Do you want to update the number of attachments to your sharepoint list?

Why do you want to use variable to update?

Actually, I agree with @WarrenBelz . The formula that he provided is right.

Firstly, you need to create a number column in your sharepoint list.

Then in your custom form, set that datacard's Default to:

CountRows(ThisItem.Attachments)

 Then this field will display as the number of attachments by default.

616.PNG

 

 

 

Best regards,

 

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

View solution in original post

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @IanWall ,

CountRows(ThisItem.Attachments)

will get you the number of attachments on the current record. You just need to have this label inside the form.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-yutliu-msft
Community Support
Community Support

Hi @IanWall ,

Do you want to update the number of attachments to your sharepoint list?

Why do you want to use variable to update?

Actually, I agree with @WarrenBelz . The formula that he provided is right.

Firstly, you need to create a number column in your sharepoint list.

Then in your custom form, set that datacard's Default to:

CountRows(ThisItem.Attachments)

 Then this field will display as the number of attachments by default.

616.PNG

 

 

 

Best regards,

 

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

Thanks @v-yutliu-msft ,

That is better than almost . . .

@IanWall , happy to assist further if required.

Thanks both for your help with this - I now have a datacard with the CountRows statement, and this is being passed to SharePoint successfully.

 

@v-yutliu-msft, to answer your question about why I need a variable, and for anyone who may find this discussion at a later date:


The PowerApp allows a user to upload personnel documents to a SP site, and the flow that sits behind it adds metadata and stores the documents in the correct place. 

Working on a symmetric network, this worked fine, but under lockdown at home (and with very poor upload capability) I found that the flow would often trigger before all the attachments had been uploaded. 

Passing the attachment count to SP allows me to configure the flow with Do Until>Get attachments>Delay so that it won't progress until the number of attachments that have been received equal the number that were sent.

 

One other point is that I was hoping that PA would allow you to manage and pass variables without setting up a datacard, but I've got round this (to some extent) by simply not displaying the card to end users.

 

Hope this helps, and thanks again both.

Thanks @IanWall ,

Can you please close this by Accepting as Solution - you can accept more than one post if you choose.

Hi @IanWall ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @IanWall ,

Do you have any other problem?

If not, could you choose one solution as your issue's answer?
Thanks!

 

 

Best regards,

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,436)