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

SharePoint List Forms Date Checking on Save

Newbie here.

 

I have a SharePoint List Form that I'm editing in PowerApps. There are 2 date/time fields ("Start" & "End") in my SharePoint list. I want to do a bit of error checking to see if Start is after End. If Start is after End, I want an error message to appear when the user hits "Save" on the form since Start should not be after End.

 

Based on my research, I need to edit OnSave in SharePointIntegration.  Here's what I've tried (among many other things):

 

ben94607_4-1600731472259.png

 

PowerApps does not detect a syntax error in the code, but the code does not work since it does not detect when Start is after End. 

 

My SharePoint List has the date/time fields "Start" and "End." My PowerApps form has these cards:

ben94607_3-1600731203071.png & ben94607_2-1600731161131.png

 

Any ideas? Thank you for your help!

 

-Ben

2 ACCEPTED SOLUTIONS

Accepted Solutions
eka24
Super User III
Super User III

Since the validation is occurring on App, change the start and end to;

If(

DateValue1.SelectedDate>

DateValue2.SelectedDate,Notify(.….))

------------

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

KrishnaV
Super User III
Super User III

Hi @ben94607 ,

 

try this:

If(DateDiff(DateValue2.SelectedDate,DateValue1.SelectedDate,Days)>0,SubmitForm(SharePointForm1),Notify("End Date can't be less then the start date"))

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

7 REPLIES 7
eka24
Super User III
Super User III

Since the validation is occurring on App, change the start and end to;

If(

DateValue1.SelectedDate>

DateValue2.SelectedDate,Notify(.….))

------------

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

KrishnaV
Super User III
Super User III

Hi @ben94607 ,

 

try this:

If(DateDiff(DateValue2.SelectedDate,DateValue1.SelectedDate,Days)>0,SubmitForm(SharePointForm1),Notify("End Date can't be less then the start date"))

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

ben94607
Frequent Visitor

Thank you. That works well. Is there a way to incorporate the time in there also so that it compares both date & time? 

Unfortunately no! if that helps your issue please mark it as a solution so that the new members will make use of it.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

What will be the purpose of the time?

Is time not part of your date already

------------

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.

 


I just want to follow up with you on this issue to see is it resolved or still you see any challenges.

If you see any challenge/need further help let me know I am always happy to help


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
ben94607
Frequent Visitor

The form is a leave request form. It's important to see if the start date & time is later than the end date & time. I thought of having a nested if statement to first test for date and then time, but I was hoping for something more straight forward. Thanks!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

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 the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (39,103)