I am trying to implement a save feature on my site but it isn't working. I don't even know when my job gets fired or not. I would like to have some assistance on implementing this on the site.
My code:
{
"jobs": [{
"functionLocation": "/updates/new-file.updatedata",
"description": "Update contact info",
"executionConfig": {
"time": "11:26" //wait 5 min.
}
}
]
}
// mandatory, “hh:mm” format based on utc
//"dayOfWeek": "Tuesday" //, Optional: // Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
//"dateInMonth": Number // Optional: number between 1-31
// /backend/jobs.config
new-file.js file is below:
import wixData from 'wix-data';
export function updatedata() {
let toSave = {
"title": "Mr.",
"firstname": "John",
"lastname": "Doe"
};
wixData.insert("contact", toSave).then((results) => {
let item = results; //see item below
})
.catch((err) => {
let errorMsg = err;
});
}
Please let me know what I am doing wrong. Or is there a way to turn the "job.config", lack of better words, On? I would like to get down to the bottom of my curiosity! :)
I see they finally introduced the new feature, I just wish they had give better examples of your limitations or how you know it worked. I still love wix code or Corvid. I appreciate all the help they give to us in this forum.
#WIXCODE #CORVID #ILOVECORVID #JOB #JOBSCHEDULER #AWESOMECODE
Hi Nino,
Your code and setup appears correct.
Make sure to check your Live collection.
Due to its nature the Job Scheduler feature does not work in Preview mode and therefore only updates the Live collection.