For the life of me I can not get the wixBookings.getServiceAvailability function to work… it returns nothing.
In my code I have a forItem loop for specific items in my repeater that I need to take the service id of the Booking Service and I pass it to the wixBookings.getServiceAvailability in an attempt tp get the Staff Member.
originalPropertiesInfo = []; //reset
i = 0;
$w(“#repeater1”).forItems( keepvalues, ($item, itemData, index) => {
let lookupserviceid = $item(“#itemId”); //Service Id from itemData
console.info(’ Keeping '+ lookupserviceid.text) //prove that the service id returns. it does.
originalPropertiesInfo[i] = itemData; //Save this record for a new collection
//Get the staff member for the service
wixBookings.getServiceAvailability(lookupserviceid.text)
.then( (availability) => {
let slots = availability.slots;
let firstSlot = slots[0];
console.info(firstSlot.staffMemberId)
} );
i=i+1;
} ) ;
originalPropertiesInfo.sort(performSort);
$w(‘#repeater1’).data = originalPropertiesInfo;
console.info(originalPropertiesInfo);