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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Notify & Navigate if R...
Power Apps
Unanswered

Notify & Navigate if Record Already Exists

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

Hope someone has some advice.

 

Im have a desk reservation App & I would like to limit one booking per date (per user).

 

Currently the App flow works like this:

 

 

Set(
 selectedDate,
 Calendar_1.StartDate
);
Set(
 selectedEndDate,
 Calendar_1.EndDate
);
Set(
 startTime,
 DateTimeValue(
 Text(
 selectedDate,
 DateTimeFormat.ShortDate
 ) & " " & ddTimeFrom.Selected.Value
 )
);
Set(
 endTime,
 If(
 DateValue(
 Text(
 selectedEndDate,
 DateTimeFormat.ShortDate
 )
 ) < DateValue(
 Text(
 selectedDate,
 DateTimeFormat.ShortDate
 )
 ),
 DateTimeValue(
 Text(
 selectedDate,
 DateTimeFormat.ShortDate
 ) & " " & ddTimeTo.Selected.Value
 ),
 DateTimeValue(
 Text(
 selectedEndDate,
 DateTimeFormat.ShortDate
 ) & " " & ddTimeTo.Selected.Value
 )
 )
);
If(
 IsBlank(
 LookUp(
 'Desk Reservations',
 CheckOutFrom = selectedDate && CheckOutTo = selectedEndDate
 )
 ),
 Navigate(Dashboard),
 Notify("You have already made a booking for this date")
);
If(
 IsEmpty(startTime) && IsEmpty(endTime),
 Notify(
 "You must select a date and time to continue",
 NotificationType.Warning
 ),
 Navigate(FloorSelect)
)

 

What I can't figure out is how to notify & navigate the user back to the main screen if they already have a booking for the date selected.

 

My data source is an SP list, which holds the date the user has booked in.

 

I have variables (as seen above) of selectedDate & selectedEndDate. Im trying to check via a lookup if that booking, for the user already exixts, and if so - Flag a warning notification telling them they already have a booking for that date.

 

I currently get the notification that I already have a date booked - but it doesn't navigate back to the home screen, rather it continues to the next screen, which is where a user selects a floor.

 

Ryan28_0-1634311983964.png

 

 

Any ideas how I can prevent the user from continuing?

 

Thanks,

 

Ryan

 

 

Categories:
I have the same question (0)
  • MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hey @Anonymous 

    when you click on the button, you execute the following code:

    [..];
    If(
     IsBlank(
     LookUp(
     'Desk Reservations',
     CheckOutFrom = selectedDate && CheckOutTo = selectedEndDate
     )
     ),
     Navigate(Dashboard),
     Notify("You have already made a booking for this date")
    );
    If(
     IsEmpty(startTime) && IsEmpty(endTime),
     Notify(
     "You must select a date and time to continue",
     NotificationType.Warning
     ),
     Navigate(FloorSelect)
    )

    The important part is where you put your if conditions. In your case the last IF() function checks if startTime and endTime is empty. From the code above I can see, that when a user selects a date and time, this fields are never empty, so they navigate to the Screen "FloorSelect" even when the if before shows a notification that they already made a booking for this date. You should consider to combine this to IF() functions so that it first checks if there is already a booking and if not it checks if the user selected startTime and endTime and only then navigate to the FloorSelect Screen.

     

    Hope this helps you

     

    Best regards
    Marvin

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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard