Search...
onBookingScheduleUpdated( )
An event that fires when a booking's schedule is updated.
Description
The onBookingScheduleUpdated()
event handler runs when a booking's schedule is updated.
The event
object includes a trigger
property that describes the action that triggered the event.
The trigger
value is one of:
"OWNER_UPDATED_SESSION"
: The booking's session was updated by the business."MEMBER_RESCHEDULED_BOOKING"
: The booking was rescheduled by the member."OWNER_CANCELED_SESSION_IN_SET"
: A session in a set of sessions was canceled by the business. A session is part of a set when it belongs to a schedule that has"course"
as one of its tags.
Note: Backend events don't work when previewing your site.
Syntax
function onBookingScheduleUpdated(event: BookingEvent): void
onBookingScheduleUpdated Parameters
NAME
TYPE
DESCRIPTION
event
BookingEvent
Information about a booking with an updated schedule.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event when a booking schedule is updated
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3export function wixBookings_onBookingScheduleUpdated(event) {4 const eventTrigger = event.trigger;5 const bookingId = event.booking._id;6}78/* Full event object9 * {10 * "trigger": "OWNER_UPDATED_SESSION",11 * "booking": {12 * "_id": "98edaf1a-6dcf-4cd5-90c7-02983649227c",13 * "bookedResources": [{14 * "id": "3eaef8e0-465f-47a0-a686-16620dfb20dc",15 * "name": "Harold Snow",16 * "email": "hs@a.com"17 * }],18 * "status": "CONFIRMED",19 * "createdDate": "2021-02-28T17:58:45.568Z",20 * "bookingSource": {21 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",22 * "appName": "Wix Bookings"23 * },24 * "bookedEntity": {25 * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441",26 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",27 * "singleSession": {28 * "sessionId": *"193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7ExgIRM1HunZjEPUQ0IeScwcTFJNXEmLG2g *6Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyyy5IVhgtDpF30FnQEWHzPMns58Sr8MvMAWkXSK8uJwh6UEdKaJSUymSrx *fZLltS56uD8nF6wfFUUkwcJNPklOZY3iwdK69i4mBxWWKleDBJrtctN2M4M3JVsi9kJ5cH8fSCPxUUQyqeKqquHxIyAF7TAe *wiEN6ID3HACgTwE6n5FaQ6cDssdarwuTWaqsFQ0GEhtgJvZ",29 * "start": "2021-03-18T16:30:00.000Z",30 * "end": "2021-03-18T17:00:00.000Z"31 * },32 * "title": "Yoga Class",33 * "rate": {34 * "labeledPriceOptions": {35 * "general": {36 * "amount": "50",37 * "currency": "USD",38 * "downPayAmount": "0"39 * }40 * }41 * },42 * "tags": ["GROUP"],43 * "location": {44 * "address": "123 West Street, New York, New York",45 * "customAddress": {46 * "formatted": "123 West Street, New York, New York"47 * },48 * "locationType": "OWNER_CUSTOM"49 * }50 * },51 * "paymentDetails": {52 * "balance": {53 * "finalPrice": {54 * "amount": "50",55 * "currency": "USD",56 * "downPayAmount": "0"57 * },58 * "amountReceived": "0"59 * },60 * "state": "PENDING_MARK_AS_PAID",61 * "wixPayMultipleDetails": [{62 * "txId": "dccef7b1-0b8a-47a2-af8a-4cd349a3f8cb",63 * "orderId": "c3e0e57a-b8fc-48a8-9869-e0839aed92ce",64 * "orderAmount": "50",65 * "paymentVendorName": "inPerson",66 * "orderApprovalTime": null67 * }]68 * },69 * "formInfo": {70 * "paymentSelection": [{71 * "rateLabel": "general",72 * "numberOfParticipants": 173 * }],74 * "additionalFields": [{75 * "id": "00000000-0000-0000-0000-000000000008",76 * "label": "Add Your Message",77 * "valueType": "LONG_TEXT"78 * }],79 * "contactDetails": {80 * "contactId": "baf3cd37-c32c-4f01-9e1a-c8ab152af490",81 * "firstName": "Adam Smith",82 * "email": "asmith@amail.com",83 * "phone": "9998765",84 * "timeZone": "America/New_York",85 * "countryCode": "US"86 * }87 * }88 * },89 * "previousBooking": {90 * "_id": "98edaf1a-6dcf-4cd5-90c7-02983649227c",91 * "bookedResources": [{92 * "id": "3eaef8e0-465f-47a0-a686-16620dfb20dc",93 * "name": "Harold Snow",94 * "email": "hs@a.com"95 * }],96 * "status": "CONFIRMED",97 * "createdDate": "2021-02-28T17:58:45.568Z",98 * "bookingSource": {99 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",100 * "appName": "Wix Bookings"101 * },102 * "bookedEntity": {103 * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441",104 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",105 * "singleSession": {106 * "sessionId": *"193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7ExgIRM1HunZjEPUQ0IeScwcTFJNXEmLG2g *6Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyyy5IVhgtDpF30FnQEWHzPMns58Sr8MvMAWkXSK8uJwh6UEdKaJSUymSrx *fZLltS56uD8nF6wfFUUkwcJNPklOZY3iwdK69i4mBxWWKleDBJrtctN2M4M3JVsi9kJ5cH8fSCPxUUQyqeKqquHxIyAF7TAe *wiEN6ID3HACgTwE6n5FaQ6cDssdarwuTWaqsFQ0GEhtgJvZ",107 * "start": "2021-03-18T16:00:00.000Z",108 * "end": "2021-03-18T16:30:00.000Z"109 * },110 * "title": "Yoga Class",111 * "rate": {112 * "labeledPriceOptions": {113 * "general": {114 * "amount": "50",115 * "currency": "USD",116 * "downPayAmount": "0"117 * }118 * }119 * },120 * "tags": ["GROUP"],121 * "location": {122 * "address": "123 West Street, New York, New York",123 * "customAddress": {124 * "formatted": "123 West Street, New York, New York"125 * },126 * "locationType": "OWNER_CUSTOM"127 * }128 * },129 * "paymentDetails": {130 * "balance": {131 * "finalPrice": {132 * "amount": "50",133 * "currency": "USD",134 * "downPayAmount": "0"135 * },136 * "amountReceived": "0"137 * },138 * "state": "PENDING_MARK_AS_PAID",139 * "wixPayMultipleDetails": [{140 * "txId": "dccef7b1-0b8a-47a2-af8a-4cd349a3f8cb",141 * "orderId": "c3e0e57a-b8fc-48a8-9869-e0839aed92ce",142 * "orderAmount": "50",143 * "paymentVendorName": "inPerson",144 * "orderApprovalTime": null145 * }]146 * },147 * "formInfo": {148 * "paymentSelection": [{149 * "rateLabel": "general",150 * "numberOfParticipants": 1151 * }],152 * "additionalFields": [{153 * "id": "00000000-0000-0000-0000-000000000008",154 * "label": "Add Your Message",155 * "valueType": "LONG_TEXT"156 * }],157 * "contactDetails": {158 * "contactId": "baf3cd37-c32c-4f01-9e1a-c8ab152af490",159 * "firstName": "Adam Smith",160 * "email": "asmith@amail.com",161 * "phone": "9998765",162 * "timeZone": "America/New_York",163 * "countryCode": "US"164 * }165 * }166 * }167 * }168 */