wixData.query("Marketing/Coupons") permissions

Hi guys,

Sadly I wrote a page that’s been launch for a few months that did a query against the “Marketing/Coupons” internal collection for my custom booking page. The sad part? I didn’t realize that this collection is “Admin” only read. This meant that it work great for me (an admin), but I didn’t realize that for any of my user this didn’t work because they don’t have the permissions to read this collection.

Normally I would change this collections permissions, but the “Marketing/Coupons” collection is locked as “Admin” read only and can not be change.

With this in mind, how can I read this data and return it to my booking page? I need it to provide discounts on my booking page. Is there a back-end function that would allow me to get this data and return in to my client side.

Here is what I was doing:

async function getAllCoupons() {
	const data = await wixData.query("Marketing/Coupons").find();
	return  data.items;
}

...{other function}
allcoupons = await getAllCoupons();
allcoupons.forEach(couponitem => couponsMap[couponitem.code] = couponitem);
    

Thank you.
David

Maybe duplicate the data to a collection that you do have control over on the backend and then hook to the r/w collection.

Hi Robert.

Yes that’s what i did as a work-around for now. I exported the Marketing/Coupons collection to a CSV and created a new collection from that CSV that I’m pointing my site to.

What do you mean by “hook”?

Can i setup something on the Marketing/Coupons collection that will replicate that data to another table that I control?

David

it’s don’t work for me…

In order to be successful in marketing, you need to use an email finder https://getprospect.com/email-finder to locate the email addresses of prospective customers. But doing things by hand may be boring and slow. Thankfully, there are programs available that may help you locate email addresses, and some of them even deliver confirmed addresses in a matter of minutes.