cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KevHouston
Frequent Visitor

How best to combine notification validations?

Hi


I have two validation notifications associated with the submit button of a PowerApps SharePoint list form.

The validation surrounds two date fields, RequestedStartDate (dteStartDate) and RequestedCompletionDate (dteEndDate).

 

Seperately added to the submit button both scenarios operate, but together they fail and the form submits with invalid options selected in the Date fields

Validation 1 is to prevent completion date being earlier than start date;

If(dteStartDate.SelectedDate > dteEndDate.SelectedDate ,
Notify("Requested Completion Date must be greater than Requested Start Date", NotificationType.Error)

Validation 2 is to add a lead time of 3 days to start date;

 

If(dteStartDate.SelectedDate < Today()+3, Notify("Please select a requested start date at least 3 days from today", NotificationType.Error) ,
 SubmitForm(CreateItemForm);NewForm(CreateItemForm)))

 

I Have attempted to use &, &&, Or, And - without success.

Can anyone suggest how both can operate together?


If(dteStartDate.SelectedDate > dteEndDate.SelectedDate ,
Notify("Requested Completion Date must be greater than Requested Start Date", NotificationType.Error) And If(dteStartDate.SelectedDate < Today()+3, Notify("Please select a requested start date at least 3 days from today", NotificationType.Error) ,
 SubmitForm(CreateItemForm);NewForm(CreateItemForm)))

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

Try:

If(dteStartDate.SelectedDate < Today()+3 Or dteStartDate.SelectedDate > dteEndDate.SelectedDate ,
Notify("Please select a requested start date at least 3 days from today", NotificationType.Error),
SubmitForm(CreateItemForm);NewForm(CreateItemForm))
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

2 REPLIES 2
eka24
Super User
Super User

Try:

If(dteStartDate.SelectedDate < Today()+3 Or dteStartDate.SelectedDate > dteEndDate.SelectedDate ,
Notify("Please select a requested start date at least 3 days from today", NotificationType.Error),
SubmitForm(CreateItemForm);NewForm(CreateItemForm))
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

KevHouston
Frequent Visitor

Thank you. I had to combine the notification text to accomodate both situations. 

Appreciate your response.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,497)