cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Patron
Post Patron

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

@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 III
Super User III

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

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

@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

thanks @mdevaney  worked perfectly!!!

 

Joe

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (7,501)