cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
audrieg
Level 10

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
Level 10

Re: Patch() Function Not Submitting to SharePoint Online

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.

 

6 REPLIES 6
audrieg
Level 10

Re: Patch() Function Not Submitting to SharePoint Online

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.

 

Beuferd
Level: Powered On

Re: Patch() Function Not Submitting to SharePoint Online

Thank you.

Your posting helped a lot.

Thanks for taking the time

 

 

Super User
Super User

Re: Patch() Function Not Submitting to SharePoint Online

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
Level: Powered On

Re: Patch() Function Not Submitting to SharePoint Online

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. 
wjhepworth
Level: Powered On

Re: Patch() Function Not Submitting to SharePoint Online

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

Highlighted
Jack_Stewart
Level: Powered On

Re: Patch() Function Not Submitting to SharePoint Online

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!