Sorry I am a complete noob when it comes to automation payload code.
What I need is very simple! on payment successful update variables in CMS.
How do I update variables in CMS using automation feature?
My noob code below does not work!
import wixData from ‘wix-data’;
/**
- Autocomplete function declaration, do not delete
- @param {import(‘./schema.js’).Payload} options
*/
export const invoke = async ({payload}) => {const Lim = “Limit”;
const LimID = “SINGLE_ITEM_ID”;wixData.get(Lim, LimID)
.then((item) => {let toUpdatevar = {
“Var1”: 5,
“var2”: 45,
“var3”: item.var3 + 3,};
wixData.update(“Limit”, toUpdatevar)
})
return {} // The function must return an empty object, do not delete
};
Anyone knows how to update cms with automation I would greatly appreciate it!
There is very little documentation and I never did any automation or async functions before.