setAttendance( )


Sets the number of people who actually attended the session for the given booking.

The setAttendance() function returns a Promise that resolves when attendance information has been updated.

The number of attendees can be greater than 1 when the booking is made for a group of people. Set the attended boolean to true if the customer making the booking or anyone from their group attended.

Notes:

  • There is no validation on the number of attendees or on the relationship between numberOfAttendees and attended.
  • Only users with Bookings Admin permissions can set the attendance for a booking. You can override the permissions by setting the suppressAuth options to true.
Method Declaration
Copy
function setAttendance(
  bookingId: string,
  attendanceInfo: AttendanceInfo,
  options: Options,
): Promise<Booking>;
Method Parameters
bookingIdstringRequired

ID of the Booking to be updated.


attendanceInfoAttendanceInfoRequired

Attendance information for the booking


optionsOptions

An object representing the available options for setting attendance.

Returns
Return Type:Promise<Booking>
Set attendance information
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { bookings } from "wix-bookings-backend"; export const setAttendance = webMethod(Permissions.Anyone, async () => { const bookingId = "25a285ec-fc3b-4ca3-bb05-42ec7b510c2e"; const attendanceInfo = { attended: true, numberOfAttendees: 3, }; try { const booking = await bookings.setAttendance(bookingId, attendanceInfo); return booking; } catch (error) { return error; } }); /* Returns a promise that resolves to a booking object: * * { * "_id": "7125331e-75e6-4889-809a-5dea10648b30", * "bookedEntity": { * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441", * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179", * "singleSession": { * "sessionId": * "1ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7ExgIRM1* HujEPUQ0IeScwcTFJNXEmLG2g6Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyyy5* IVtDpF30FnQDoG8I60n21QAlhok4LHNlkBszoGZ67jGMeDOqxS8PXZgJx87ByXwfgsN* 3AbndYxESrFnttLnRSFzcsolPAjYhaRCdJBhUj8rAoBoj71MgiFi4Tw3FDyVZz2OeOH* GmwRi0ELuqZvw0Y5tmMXrIKa48SvG8sr2MyOQsaIbMHy8YX1Q8anAgfdt", * "start": "2021-01-22T10:30:00Z", * "end": "2021-01-22T11:00:00Z" * }, * "title": "Yoga Class", * "location": { * "locationType": "OWNER_BUSINESS" * }, * "rate": { * "labeledPriceOptions": { * "general": { * "amount": "50", * "currency": "USD", * "downPayAmount": "0" * } * } * }, * "tags": [ * "GROUP" * ] * }, * "bookedResources": [ * { * "_id": "76570209-101f-409b-af97-b445bdb63125", * "name": "John Smith", * "email": "jsmith@gmail.com" * } * ], * "status": "PENDING_CHECKOUT", * "_createdDate": "2021-01-11T08:45:00.214Z", * "attendanceInfo": { * "attendanceStatus": true, * "numberOfAttendees": 1 * }, * "bookingSource": { * "platform": "WEB", * "actor": "CUSTOMER", * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97", * "appName": "Wix Bookings" * }, * "formInfo": { * "paymentSelection": [ * { * "rateLabel": "general", * "numberOfParticipants": 1 * } * ], * "additionalFields": [ * { * "_id": "00000000-0000-0000-0000-000000000008", * "value": "Cant wait to start", * "label": "Add Your Message", * "valueType": "LONG_TEXT" * } * ], * "contactDetails": { * "contactId": "a6d4c19e-1882-4e29-9eb3-411e1aeeb874", * "firstName": "Joe Green", * "email": "JoeGreen@hmail.com", * "phone": "9998765", * "timeZone": "America/New_York", * "countryCode": "US" * } * }, * "paymentDetails": { * "balance": { * "finalPrice": { * "amount": "50", * "currency": "USD", * "downPayAmount": "0" * }, * "amountReceived": "0" * }, * "state": "PENDING_CASHIER", * "wixPayMultipleDetails": [ * { * "orderId": "dd702e88-68e0-4faa-94b2-4996136a9828", * "orderAmount": "50", * "orderStatus": "UNDEFINED" * } * ] * } * } * */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?