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

Re: How best to combine notification validations?

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

Re: How best to combine notification validations?

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

Highlighted
Frequent Visitor

Re: How best to combine notification validations?

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

Appreciate your response.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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