web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching columns to SP...
Power Apps
Answered

Patching columns to SP library from Powerapps

(0) ShareShare
ReportReport
Posted on by 19

Hi All,

     I've got an app that links to a SP library as a data source ( I want a library rather than a list as I have a populate word document flow linked to the library that I want to keep). I've tried all sorts to patch the forms to the library with not a lot of success, so am trying to patch the individual tables to the library columns instead. 

    The data cards are all linked to the SP library 'Risk Assessments', some of the columns are choice, some single line text, some multi text, 1 date, and others pull data from datacards elsewhere in the app.

    Through research it looked like I could get away with the below, but I get the error that I need to use SPFileCollection.Add(), so I guess the question is, is it possible to patch datacards to a SP datasource(library), or will I need to create a library of lookup columns and link them to a list?

   Would appreciate anyone being able to have a look at the below and see if there's anything glaring that I've missed? 

 

Thanks

 

Patch('Risk Assessments',
{'Job Type':DataCardValue66.Selected.Value},
{'Activity':DataCardValue35.Text},
{'Team members': DataCardValue58.SelectedItems}, {'Date': DataCardValue31.SelectedDate},
{'Task Location':DataCardValue32.Text},
{'Task 1': DataCardValue33.Text},
{'Task 1 Hazards':DataCardValue36.SelectedItems},
{'Task 1 existing controls': DataCardValue37.SelectedItems},
{'Task 1 consequence': DataCardValue55.Selected},
{'Task 1 likelihood': DataCardValue59.Selected},
{'Task 1 additional controls': DataCardValue42.Text},
{'Task 1 residual consequence':DataCardValue56.Selected},
{'Task 1 residual likelihood':DataCardValue57.Selected});

Categories:
I have the same question (0)
  • Verified answer
    CU-18081211-6 Profile Picture
    9,270 Moderator on at

    Hi @JLaw973 ,

     

    The central item of a document library record is the File /Folder itself, or in your case it seems that this important piece is missing. You'll have no problem to update the columns of a record (if the file is already exist in document library), but you cannot create a new record in document library if don't suply the file and this is not posible right now from PowerApps.

     

    You can find over the internet some great videos about how to upload a file using PowerApps and PowerAutomate.

     

    So ... I think you should reconsider your solution and adopt a Sharepoint list as database and keep your file doc as item's attachament.

     

    On the other hand, please note that the  Patch syntax to update an item is :

    Patch(DataSource, Item from DataSource, {Column1:Value,Column2:Value, ....})

    and to create a new item:

    Patch(DataSource, Defaults (DataSource), {Column1:Value,Column2:Value, ....})

     

    So I think that if you want to update an item in the list your code has to be similar to:

    Patch('Risk Assessments',LookUp('Risk Assessments', .... ),
    {'Job Type':DataCardValue66.Selected.Value},
    Activity':DataCardValue35.Text,
    'Team members': DataCardValue58.SelectedItems, 'Date': DataCardValue31.SelectedDate,
    'Task Location':DataCardValue32.Text,
    'Task 1': DataCardValue33.Text,
    'Task 1 Hazards':DataCardValue36.SelectedItems,
    'Task 1 existing controls': DataCardValue37.SelectedItems,
    'Task 1 consequence': DataCardValue55.Selected,
    'Task 1 likelihood': DataCardValue59.Selected,
    'Task 1 additional controls': DataCardValue42.Text,
    'Task 1 residual consequence':DataCardValue56.Selected,
    'Task 1 residual likelihood':DataCardValue57.Selected})

     

    Hope it helps !

  • JLaw973 Profile Picture
    19 on at

    Hi @gabibalaban

             Thanks for your help, I was hoping that it was possible just to update the columns in a library without the doc being submitted as well, as the app is a mobile app I don't think it's feasible to update the template in the library, so as you say, will need to find another way!

         Thanks for taking the time to have a look.

  • Harris021 Profile Picture
    181 on at

    @gabibalabanMy situation is the user uploads a document first, and then they will update the lookup column. What would the patch script be for this? I have made it work if I use the SP list, but I am using the doc library.

     

    Patch(
     'Harris Document Testing 5000 records',
     LookUp('Harris Document Testing 5000 records'),
     {
     Title: DataCardValue4.Selected.Title,
     FileNmae: DataCardKey1
     } 
    );

      

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard