cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
joef
Level 8

edit form submission on unique items

Hi All,

Happy Holidays!!!

 

I have an App on top of an SPO list.  I set the Item number to be unique in the list.  I have an error in the app if you try to submit a duplicate item number.

I set my edit button to only be visible for items added today.  but if I go to edit an existing item, I get the duplication error and I can not submit the form.

 

how do I differentiate between an update to an existing as opposed to adding a new item?

 

Thanks,

Joe

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: edit form submission on unique items

@joef 

Yes, of course.  We can check if the FormMode is Edit using a logical statement.

Form1.Mode=FormMode.Edit

 

It can be used within an IF statement like this

If(Form1.Mode=FormMode.Edit, some_code_true, some_code_false)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
Super User
Super User

Re: edit form submission on unique items

@joef 

The way to differentiate between inserting a new row and updating an existing row are the NEWFORM and EDIT form functons respectively. Typically you would use these functions in the OnSelect property of a button used to navigate to the Form.

 

NewForm(your_form_name);Navigate(your_screen_name);

 

EditForm(your_form_name);Navigate(your_screen_name);

 

 

Link To MS Documentation for Forms

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-form

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
joef
Level 8

Re: edit form submission on unique items

Hi @mdevaney ,

I hit send too soon, I left out the code that is stopping me from continuing...

on the submit button, I check to make sure the location number = the 1st 3 digits of deposit number, then I check to see if the item is in the list.  Is there a way to check if I am editing before checking?

 

If(
LocationValue.Text <> Left(DepoNumberValue.Text,3),
Notify("The Location you entered does not match the deposit slip number, please make sure your location is 3 digits and match the first 3 digits of the deposit slip number and try again", NotificationType.Warning),
IsBlank(
LookUp('Edison Deposit Entry', 'Deposit Slip Number' = DepoNumberValue.Text).'Deposit Slip Number'
),
// If its blank then there's no existing value with that same value so submit

SubmitForm(EditForm1)
,
// If its not blank then let the user know and switch focus to that field
Notify("The deposit slip you entered is already in the system, please check your number and try again", NotificationType.Warning);
SetFocus(DepoNumberValue)
)

 

Thanks again,

Joe

Super User
Super User

Re: edit form submission on unique items

@joef 

Yes, of course.  We can check if the FormMode is Edit using a logical statement.

Form1.Mode=FormMode.Edit

 

It can be used within an IF statement like this

If(Form1.Mode=FormMode.Edit, some_code_true, some_code_false)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

joef
Level 8

Re: edit form submission on unique items

thanks @mdevaney  worked perfectly!!!

 

Joe

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,072)