Hi, is there a simple way to query the contacts collection for all contacts made on the same day of the year as the current date? I’m trying to set up a daily job which checks for all contacts made on the same day of the year and send those contacts a signup/birthday email. As far as I’m aware this cannot be achieved with native wix automations. Would appreciate some help.
This code belongs to the backend-section.
import { contacts } from 'wix-crm-backend';
/* Sample options value:
* {
* suppressAuth: true
* }
*/
export async function myQueryContactsFunction(options) {
try {
const queryResults = await contacts.queryContacts().find(options);
const items = queryResults.items;
const firstItem = items[0];
const pageSize = queryResults.pageSize;
const hasNext = queryResults.hasNext();
const hasPrev = queryResults.hasPrev();
const length = queryResults.length;
const query = queryResults.query;
return items;
} catch (error) {
console.error(error);
// Handle the error
}
}
This should give you back all contacts as result.