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

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

Highlighted
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

Highlighted
Post Patron
Post Patron

Re: edit form submission on unique items

thanks @mdevaney  worked perfectly!!!

 

Joe

Helpful resources

Announcements
Check this Out

Announcing

Class of 2020- Season 2

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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