setAttendance( )
Sets information about whether a booking's session was attended. This information
is saved in an Attendance
object.
Description
If attendance was already set, meaning the Attendance
object already exists, the
existing attendance information is updated. Otherwise, a new Attendance
object
is created.
By default, the number
of attendees is set to 1
, but you can set a number to greater than 1
if multiple
participants attended. Do not set to 0
to indicate that no one attended the session.
Instead, set the status
field to NOT_ATTENDED
.
Note: Make sure your code validates that:
- There is no mismatch between
numberOfAttendees
andattendanceStatus
to make sure, for example, thatattendanceStatus
is notNOT_ATTENDED
whilenumberOfAttendees
is5
.- The attendance's
numberOfAttendees
and the booking'snumberOfParticipants
correspond. For example, the number of attendees usually should not exceed the booking's intended number of participants (unless perhaps you allow walk-ins that did not sign up in advance).
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function setAttendance(attendance: Attendance): Promise<SetAttendanceResponse>
setAttendance Parameters
NAME
TYPE
DESCRIPTION
The attendance information for a booked session that you want to create or update.
Returns
Return Type:
NAME
TYPE
DESCRIPTION
The created or updated attendance information for the booked session.
Was this helpful?
setAttendance example
1import { attendance } from 'wix-bookings.v2';23 async function setAttendance(attendance) {4 try {5 const result = await attendance.setAttendance(attendance);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13