Hi Dojo,
How can I retrieve all reservations? And separately, how can I define a filter by either the Status prop or the Booking Life Cycle status?
Can't seem to pass in a null filter value to `SrmManagers.ResourceManager.GetReservationInstances()`, so is there a suggested way to retrieve all of them without me resorting to supplying `ReservationInstanceExposers.End.GreaterThan(new DateTime(1970, 1, 1))`.
I can't seem to find adequate documentation on the ReservationInstanceExposers class.
Thanks
Hi Vish,
All reservations can be retrieved by providing a TrueFilterElement as filter:
var reservations = SrmManagers.ResourceManager.GetReservationInstances(new TRUEFilterElement<ReservationInstance>());
Would use this very carefully though, because on bigger systems, retrieving all reservations without filter could cause performance issues.
Regarding your second question to filter on booking status and life cycle status, that can be done as follows:
var filter1 = ReservationInstanceExposers.Status.Equal((int)ReservationStatus.Ongoing);
var filter2 = ReservationInstanceExposers.Properties.StringField("Booking Life Cycle").Equal("Service Active");
var combinedFilter = new ANDFilterElement<ReservationInstance>(filter1, filter2);
Sure, I’ve updated my answer.
Thanks Tom, that’ll do the trick.
Additionally, would you know how to filter by either the reservation instance’s Status prop or the Booking Life Cycle status?
EDIT: actually had a look at existing SRM scripts and found a filter by the Status prop
FilterElement filter = ReservationInstanceExposers.Status.Equal((int)ReservationStatus.Ongoing);
Unlikely I’ll need to filter by booking lifecycle status, but if there is a way, I’d be curious to know how?