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 / Submitting Global Vari...
Power Apps
Unanswered

Submitting Global Variable values to Sharepoint Lists

(0) ShareShare
ReportReport
Posted on by

Hi, 

 

I am new to Powerapps and have tried to follow other threads but not having much luck.

 

I have an app that asks some questions but I have set a global variable for each question such as age, gender, etc. I also made a Sharepoint list with columns that are Age, Gender, etc and what I want is to click a submit button it will move the values chosen of each variable selected into their corresponding columns as one row. 

 

I have tried using Collect and Patch functions and getting errors. I have somehow ended up with the code using for example Collect(SPList, {Title:age}) and it has filled in the first column but am not sure how to edit this code to include the other variables to appear in their respective columns as my attempts have had the columns come out as blank. 

 

If anyone can help, that would be great. 

 

 

Categories:
I have the same question (0)
  • Delid4ve Profile Picture
    795 on at

    You need to use Patch or UpdateIf to modify sharepoint.

     

    For a new record:

     

    Patch(SPList,Defaults(SPList),{Age:AgeVariableName,Ethnicity:EthnicityVariablename})

    Also ensure you havnt got any 'Required' fields such as 'Title' as this will stop the Patch applying.

     

    If you decide at some point you want to modify a sharepoint record i would use UpdateIf as Patch will not update a Null value (i have reported many times now)

     

    Oh and so your clear:

    Collect: Pulls records into powerapps and stores them in temporary tables

    Patch: Adds or modifies a record in a datasource or collection

    UpdateIf: Modifies a record in a datasource or collection

     

     

  • Community Power Platform Member Profile Picture
    on at

    Thanks for your quick response. 

     

    I actually unrequired Title and renamed it Age as I thought it would be easier.

     

    Not sure if that might be causing problems, as I have previously tried this code before and its saying 'The specified column 'Age' (& Ethnictiy) does not exist. I have definitely set up the columns as you saw from the image attachement in my initial post, would you be able to provide more guidance on this. 

  • Delid4ve Profile Picture
    795 on at

    Powerapps doesnt like renamed columns.  Add a form and set its source to the sharepoint list, it will then show you the columns you can choose from, youll be able to find the new name then.  Make sure you have removed and readded the datasource aswell after you renamed it.

  • Community Power Platform Member Profile Picture
    on at

    So I added the form just to see the columns and I followed exactly how the column is presenting with age I even changed it to a capital A and the same with ethnicity. It is still saying these columns do not exist.. 

  • Delid4ve Profile Picture
    795 on at

    Sorry missed a bit out..

     

    On the form, add the field, then check under that item: (heres one of mine that was renamed, i have to refer to h29t rather than the actual name)

     

    Capture.PNG 

  • Delid4ve Profile Picture
    795 on at

    to be honest though, youll be better off creating a new column (do it from classic sharepoint not just by clicking the little plus button) and deleting the old column.

     

    The only reason i havnt is that i have 50+ columns and a lot of data and would mean changing so much.

  • Community Power Platform Member Profile Picture
    on at

    Wow thanks! Would have never known to look there, it seems to be working. 

     

    I also wanted to ask quickly another query. My very first question is from a dropdown listand I want to patch whatever the option they chose there. Do you know the code for this as I am trying Patch(Contact,Dropdown_Name.Selected) and it does not seem to be working. Also on the SP list, would the type of the column for this dropdown be a choice or would it still be single line of text? 

  • Delid4ve Profile Picture
    795 on at
    Patch(Contact,Defaults(Contact),{ColumnName:Dropdown_Name.Selected.Value})

    need to add .Value to the end of Selected where Value = the fieldName, so if you have a table as your dropdown datasource then Value would be the name of the column.

     

    if its an existing record then replace Defaults(Contact) with a formula such as ID=Lookup.....

     

    UpdateIf works better if its an existing record aswell, i only use patch if its a new record as it cant update null values in an existing record.

  • Community Power Platform Member Profile Picture
    on at

    Hi so if I was to add that code as part of the submit button that previously discussed would it be: 

     

     

    Patch(
     SPList,Defaults(SPList),
     {ColumnName:DropdownName.Selected.Value}) 

    I have tried this but it is not recognising the Selected.Value saying its an invalid Name. 

     

    Also on the SP List, do you know what type of data the column should be, such as single line of text or choice? 

  • Community Power Platform Member Profile Picture
    on at

    Just to update, I got it working. Thanks for all your help though.

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard