0

So I have a ui.alert that triggers and asks for confirmation before making an edit on a Google Sheet.

function confirmation(){  
  //Call Spreadsheet alert and give it a variable
  var ui = SpreadsheetApp.getUi();
  var response = ui.alert('Are you sure you want to continue? Selecting YES will remove all status updates for this across all sheets.', ui.ButtonSet.YES_NO);

// Process the user's response.
  if (response == ui.Button.NO) {
    activeCellState = 1;
    return true;
  }  else {
    return false;
  }
}

Is there any way to have/how do I make a button that triggers a timer delay, where like, it won't ask this again for the next 30 mins or so if you press a button that says "don't ask me again for 30 mins"?

0

You should store the answer of the user somewhere, then every time that the alert could be shown check the user responses and timestamp that it was asked. Perhaps storing the timestamp could be enough, but it entirely depends on you and/or the developing guidelines/style/standard you are using.

It's very likely that you should use getUserProperties() from Class PropertiesService to get the user properties object then some the get/set methods from Class Properties.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.