Search...
onProgramUpdated( )
An event that triggers when a loyalty program is updated.
Description
The onProgramUpdated()
event handler runs when the name or the point definition of the loyalty program is updated. The received ProgramUpdated
object contains information about the program that was updated.
onProgramUpdated()
does not trigger when the loyalty program's status changes.
Note: Backend events don't work when previewing your site.
Syntax
function wixLoyalty_onProgramUpdated(event: ProgramUpdated): void
onProgramUpdated Parameters
NAME
TYPE
DESCRIPTION
event
Optional
ProgramUpdated
Information about the loyalty program that was updated and metadata for the event.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event triggered when a loyalty program is updated
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3// Add the file if it doesn't exist.45export function wixLoyalty_onProgramUpdated(event) {6 const eventId = event.metadata.id;7 const programName = event.entity.name;8 const updatedDate = event.entity._updatedDate;910 console.log('Program last updated: ', updatedDate);11 console.log(event);12}1314/* Full event object:15 * {16 * "metadata": {17 * "id":"bc647d5a-0d2c-46db-b241-8eb82c431e86",18 * "entityId":"settings",19 * "eventTime":"2022-11-09T07:58:42.945654Z",20 * "triggeredByAnonymizeRequest":false21 * },22 * "entity": {23 * "name":"Frequent Flower Program",24 * "pointDefinition": {25 * "customName":"Petals",26 * "icon":"shapes/8de38e8fe76f4e9f937ae23e9ba1eb04.svg"27 * },28 * "status":"ACTIVE",29 * "_createdDate":"2022-11-07T15:26:12.798Z",30 * "_updatedDate":"2022-11-09T07:58:42.936Z"31 * }32 * }33 */34