web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to require an appr...
Power Apps
Unanswered

How to require an approval based on date

(0) ShareShare
ReportReport
Posted on by 364

Hi all, 

 

I have an app I have been working on that tracks the hours an employee spend on an engineering project. When they submit their work hours, they first select the date the work was performed on. I am wondering if it would be possible to create a rule that basically says "if the date entered is more than 1 day in the past, require an approval". I would like to use approvals in teams for this process, am unsure of which properties I need to change in my date picker. 

 

Any help is greatly appreciated!

Categories:
I have the same question (0)
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Aurora 

     

    Please let us know if anything needs on your post. We can help with this.


    Please do not forget to give kudos if you find the suggestion helpful or Accept it as a solution if works fine to help other users to find it useful.

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Aurora

     

    I assume you have 2 buttons (SubmitButton and SubmitForApprovalButton). Only one button will be visible at any time based on date selection.

    • Set the SubmitButton Visible property to
    DateDiff(DateValue1.SelectedDate,Today(),Days)<=1
    • Set visible property of SubmitForApprovalButton to
    !SubmitButton.Visible
    •  Set OnSelect property of SubmitForApprovalButton to
    Notify("if the date entered is more than 1 day in the past, require an approval",Error);SubmitForm(EditForm1)

     

    StalinPonnusamy_0-1632194551673.png

    StalinPonnusamy_1-1632194564314.png

     

     

  • Aurora Profile Picture
    364 on at

    @StalinPonnusamy 

     

    I could use some help with power automate. I initially selected a template named "Click PowerApps button to start approval of SharePoint items and send email" because I would like the flow to start when a button is pressed, however I am not sure if I can integrate teams into this template. 

     

    I imagine the app like this: If a user selects a date that is unacceptable, the error message listed above occurs. Once that error occurs, a new button appears before the user that allows the to request an approval for there hours. I would like the button to be hidden unless the need to request an approval, and I would like the approvals to be handled in Microsoft teams. The approval will allow a SharePoint site to be updated. 

     

    I appreciate any help! 

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Aurora

     

    The previous command will not submit the form. It just throws the user notification. Looks like still, the form needs to submit after the user notification. In this case

     

    Set the OnSelect property of Submit button to

     

    If(DateDiff(DateValue1.SelectedDate,Today(),Days)>1,Notify("if the date entered is more than 1 day in the past, require an approval",Error));SubmitForm(EditForm1)

     

     

    Create Power Automate to send approval if that date difference is more than 1 day.

     

    Let me know if any help needs it to create Power Automate.

  • Aurora Profile Picture
    364 on at

    @StalinPonnusamy 

     

    Works great, I'll make sure to accept it as a solution. Do you know if there is a way to automatically make a button to appear after the error message popped up to request an approval, or would this been done in power automate? 

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

     Hi @Aurora 

     

    If you are looking for user notification on submit button then Set the OnSelect command of Submit button to

     

    If(DateDiff(DateValue1.SelectedDate,Today(),Days)>1,Notify("if the date entered is more than 1 day in the past, require an approval",Error),SubmitForm(EditForm1))

     

    Note: Change fields names 

  • Aurora Profile Picture
    364 on at

    @StalinPonnusamy 

    I tried editing the mormula to:

    If(DateDiff(DataCardValue18.SelectedDate, Today(),Days) > 1, Notify("if the date entered is more than 1 day in the past, require an approval", Error))

    But I'm still not getting a notification

  • Aurora Profile Picture
    364 on at

    Do I need to create the flow first? I'm using: If(DateDiff(DataCardValue18.SelectedDate, Today(),Days) > 1, Notify("if the date entered is more than 1 day in the past, require an approval")) and it isn't returning an error message when I submit the form with a date outside of my desired boundary. 

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Aurora 

     

    For user notification. Set the OnChange property of Date Picker to

    If(DateDiff(DateValue1.SelectedDate, Today(),Days) > 1, Notify("if the date entered is more than 1 day in the past, require an approval"))

     

    Create a Power automate/Flow when the record is modified with approvals.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 422

#2
WarrenBelz Profile Picture

WarrenBelz 380 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 325 Super User 2025 Season 2

Last 30 days Overall leaderboard