Set switch on/off and save each change to the collection.

Hi Omar,

Though there may be other ways to do it, having the setTimeout function call an async function will achieve your desired result.

export function button30_click(event) {
  ChangeSwitchValue(true);
  setTimeout(function () {ChangeSwitchValue(false)}, 300000);
}

export async function ChangeSwitchValue(newValue){
  await $w('#dataset1').setFieldValue("newBoolean", newValue);
  await $w('#dataset1').save();
  console.log("data saved");
}