Hi all,
I’m working on a site for a client (using Wix Studio) that wants to track employee timesheets and give loyalty points based on days worked.
I’ve set up a CMS collection and a form on the site to allow site members to input their days worked and upload an image of their timesheet.
One of the fields (which site members can’t edit) is a “Verified” boolean field that defaults to false. The client needs to be able to go to the CMS collection, check the timesheet the member has uploaded and then change the “Verified” field to true. Currently they can do so through the site dashboard, at which point an automation triggers to set another boolean field “Credits Awarded” to true and the “Credits Earned” field to the amount of loyalty points the member will earn from that amount of days worked.
I also have Wix’s Loyalty Programme app added to the site, with the idea being that when this automation triggers it will award the member who’s timesheet was verified/approved the appropriate amount of points. This way they can then see their total accumulated points and redeem rewards all through the built-in loyalty features. The problem is that this automation isn’t triggered by the member and doesn’t give me the option to award that member loyalty points (the “Give Loyalty Points” action should appear under Client management).
I have some Velo code that adds the member’s full name and login email to fields in the CMS item, I think I could do the same to add the member’s ID to another field. However I can’t figure out how I would then use this in the automation to give the member loyalty points.
import { currentMember } from "wix-members-frontend";
$w('#text167').onViewportEnter((event) => {
$w("#dataset1").refresh()
})
$w('#button9').onClick((event) => {
currentMember.getMember()
.then((member) => {
$w('#dataset2').setFieldValue("Employee Name", member.contactDetails.firstName + " " + member.contactDetails.lastName)
$w('#dataset2').setFieldValue("Employee Email", member.loginEmail)
})
.catch((error) => {
console.error(error);
});
});
I tried instead to create a password protected page on the site that an admin could use to verify a timesheet, with the intention to figure out some code using the wix loyalty API that would give loyalty points to the right member. Unfortunately though, I don’t know of a way to allow the user to open an image from a table and change the boolean field value.
Ideally this admin page would also be a custom dashboard page but whenever I try to add one to the site, a blank popup appears and a widget is added to whichever site page I was on that (after a few moments of displaying some html) states “App Didn’t Load”.
Any advice would be appreciated!
TLDR: Site members can upload a timesheet to a CMS collection, a site collaborator then verifies the timesheet and ticks a boolean field in the item. I need an automation that works with Wix’s Loyalty Programme app to give the member who uploaded the timesheet loyalty points.

