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

I have two identical forms but only one of them creates a new entry in a SharePoint list

Hello all,

 

I have been reading through many older forum posts but unfortunately have not yet been able to find the solution to my problem.

 

I have two identical forms: one is blank and has to be filled in manually (Form1 from Screen1) and the other is filled in automatically after selecting a template from a gallery (Form2 from Screen2). Both have a SubmitForm button and with both the entries should end up in the same SharePoint list (SharePoint List 1).

 

However, it only works with Form1 for the entries to be written to the SharePoint list. For Form2, although it says that the submission was successful, no new items appear in the sharepoint list.

 

I want a completely new line to appear in the list each time one of the forms is submitted (rather than a row being updated or appended). Is this possible?

 

Many thanks in advance!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Greta1 

Yes.  I assume you are using SharePoint as your datasource.

If so, then change your Item property of the form to:

    Patch(Gallery1.Selected, {ID: Blank()})

 

This will set the primary key (ID) to be blank.  When you submit the form with SubmitForm, it is intelligent enough to know that the primary key is blank and thus it should create a record and not update one.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
Pstork1
Dual Super User
Dual Super User

Check the form mode for the second form and make sure its on New and not Edit.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
RandyHayes
Super User
Super User

@Greta1 

What is the Item property of the second form?  If you are providing a record to it and you have issues an EditForm, or the form is in the default mode of Edit, then it will be updating the record.

If you want a new record, then you need to blank out the primary key of your record for the form.

DefaultMode changing will not help you.  Your form needs to be in Edit mode always for what you want to work properly.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hey @RandyHayes thank you so much, you're right, changing the DefaultMode didn't help. My Item property for the second form is "Gallery1.Selected". Could you explain further what you mean by "blank out the primary key of your record" please? 

@Pstork1 thank you for the quick reply! My form mode was in Edit but changing it unfortunately didn't help 

@Greta1 

Yes.  I assume you are using SharePoint as your datasource.

If so, then change your Item property of the form to:

    Patch(Gallery1.Selected, {ID: Blank()})

 

This will set the primary key (ID) to be blank.  When you submit the form with SubmitForm, it is intelligent enough to know that the primary key is blank and thus it should create a record and not update one.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes is right.  Changing the mode alone won't help.  You would need to change the default values on all the form fields also.  But his solution is much more elegant.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@RandyHayes thank you so much!! That worked perfectly 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,137)