2

I have a flow to "Add a Reservation" from Account. The user needs to select the site (Lookup to Account - type site), Asset (Room) and enter the start and end date of the reservation. Screen 1

Screen 2

I am having issue checking if there is a reservation for the same site, same asset between the entered start or end date. The trouble is with the date range. My flow looks like this: Current Flow

My getReservation filters looked like this: (This just checks if there is any reservation between the start and end date you entered, which is wrong. I want it to check if the dates I entered is a part of any existing reservation) enter image description here

I tried something like the below, where I tried to get all CONFIRMED reservations for that site and asset. I tried to iterate over this collection, then I placed the decision component to check if my start or end date falls in between any of the existing reservation's dates. I am not sure how to close or end this loop. In BUild - Flow

My filters for the decision is : enter image description here

I want to know if this approach is correct or can this be done in a much simpler way? I would appreciate any help in this!

Thank you

1
  • @Prenana, if you need to check correctly for the reservations, you need to have three different 'Get Records' elements since you can't have custom filter logic in there. 1. !loopResvVar.Start__C =< Select_Start_Date AND !loopResvVar.End__c => Select_End_Date 2. !loopResvVar.Start__C => Select_Start_Date AND !loopResvVar.Start__C =< Select_Start_Date 3. !loopResvVar.End__c => Select_End_Date AND !loopResvVar.End__c =< Select_End_Date Only if all three return empty list you can be sure there is no overlapping reservation
    – mascot
    Jul 16, 2020 at 12:10

1 Answer 1

1

You are querying multiple records in the Get Records element getEligibleReservation. However, the loop Loop Reservation only checks for the first record and redirects it to either Confirmation or Duplicate Reservation screen.

Delete the connector No existing Reservation that connects to the Confirmation screen. Instead, connect this back to the loop Loop Reservation. There would be one more connector coming out from the loop After last Item. Connect this connector to the Confirmation screen.

Now, we are checking for all records in the collection. If there is a record with an existing reservation, the user is redirected to the Duplicate Reservation screen. If there is no such record in the whole collection, the user gets redirected to the Confirmation screen.

1
  • 1
    Thanks a lot Prakhar! I changed the connector as advised and it works perfectly!!
    – Prerana
    Jul 16, 2020 at 4:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .