cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
audrieg
Power Automate
Power Automate

Patch() Function Not Submitting to SharePoint Online

Are there prerequisites for using the Patch() function with SharePoint (please include SharePoint Online examples on the Power Apps learn references pages)?

 

I'm trying to submit using Patch (there is no EditForm in the app) - and the function is not returning any more errors, but the patch isn't creating a new item in the list on button press. (I am sure it's aware of the data source on SharePoint, because when I had a couple of fields misnamed, it told me to fix them because they didn't exist there. All errors are now fixed.) The dots are scrolling across the top of the UI for a few seconds (around 10 to 15 seconds), and then they stop as if all went well. No error trappable either. I thought it might be related to the site columns, because the other list I patched to was using list columns rather than site columns....however I tested the same function with list columns and it still failed.

 

Are there re-requisites I'm unaware of? Since I keep facing 'surprises' that certain field types are not supported, and unfortunately there is no list of unsupported SharePoint Online fields anywhere; I made every single column on the SharePoint list a "single line text" field, except "notes" which is a "multi-line plain text" field. (Honestly, that's not scalable - but I did it to remove opportunities for failure on submission - alas it hasn't helped.)

 

Thank you in advance for your thoughts.

1 ACCEPTED SOLUTION

Accepted Solutions
audrieg
Power Automate
Power Automate

After much trial and error (hours), I figured out what the patch statement was not working. In case this matters to anyone else here is what was going on:

 

Well I figured out the problem.

In SharePoint the Title field is defaulted to the name of the list (this is for PowerBI relationships to lists). It is also a HIDDEN field in the default form. So, this works fine on SharePoint, I can add a new item, and the title field populates itself behind the scenes.

HOWEVER, PowerApps does not check this default value, and does not alert us that it NEEDS it (for SharePoint). In any event, just by luck my gut told me to add the "Title" value to the Patch statement, and BINGO Power Apps was finally satisfied. ARGH!

 

Patch(ListName,Defaults(ListName),
{Title: "ListName",
InternalColumnName1: "TextBox1.Text",

InternalColumnName2: "TextBox2.Text",

InternalColumnName3: "TextBox3.Text",

InternalColumnName4: "TextBox4.Text"});
Navigate(BrowseListName, ScreenTransition.Fade)

 

P.S. Remember that Patch() will only take SharePoint "Internal" column names, not display names.

 

View solution in original post

8 REPLIES 8
audrieg
Power Automate
Power Automate

After much trial and error (hours), I figured out what the patch statement was not working. In case this matters to anyone else here is what was going on:

 

Well I figured out the problem.

In SharePoint the Title field is defaulted to the name of the list (this is for PowerBI relationships to lists). It is also a HIDDEN field in the default form. So, this works fine on SharePoint, I can add a new item, and the title field populates itself behind the scenes.

HOWEVER, PowerApps does not check this default value, and does not alert us that it NEEDS it (for SharePoint). In any event, just by luck my gut told me to add the "Title" value to the Patch statement, and BINGO Power Apps was finally satisfied. ARGH!

 

Patch(ListName,Defaults(ListName),
{Title: "ListName",
InternalColumnName1: "TextBox1.Text",

InternalColumnName2: "TextBox2.Text",

InternalColumnName3: "TextBox3.Text",

InternalColumnName4: "TextBox4.Text"});
Navigate(BrowseListName, ScreenTransition.Fade)

 

P.S. Remember that Patch() will only take SharePoint "Internal" column names, not display names.

 

View solution in original post

Thank you.

Your posting helped a lot.

Thanks for taking the time

 

 

hpkeong
Community Champion
Community Champion

Hi

 

Just sharing my experience with CDS (CDM) (though I am not familiar with SharePoint).

CDS uses only Field Titles, Not the Display Name.

(So, when one export CDS to Excel, the Title of the Table is Display Name, Not Field TItles;

This is totally different from EXCEL Table created in Cloud, such as Dropbox, OneDrive, where the Field Titles = Display Title)

 

Hence, I assume it applies to the same.

 

Hope this helps others as well.

hpkeong
NHU
Frequent Visitor

Thank you soooo much.  Adding to your brilliant explanation (should anyone be wondering): The internal name of a SP list column can be found by going to list settings and clicking the column as if you wanted to modify it; now you can find the internal column name in the address field of your browser, it's the part following the "&Field" argument. 

This worked.  It shouldn't be necessary.  But it worked.

Appreciate you taking the time to figure this out. I had been struggeling on my own for a few days before finding your solution. Thanks again!

Thank you for figuring this out and sharing the info! This was driving me nuts!

This really helped! Thank you!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (93,411)