cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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."

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
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,502)