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.

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

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? 

Greta1
Frequent Visitor

@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!
Pstork1
Dual Super User
Dual Super User

@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.

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

@RandyHayes thank you so much!! That worked perfectly 

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (3,766)