wixBookings.getServiceAvailability

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);

Resolved. Had to pass in the options variable, even though it said it was optional.

This is interesting… thank you for finding the issue… this seems to be bug, as on my site I’ve never had to pass this and it’s been working for months, then it suddenly stopped working… but passing the options fixed it.

Again thank you.
David