0

I have a strange problem...

Simple function like:

function onEdit() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheet = ss.getActiveSheet()
var ui = SpreadsheetApp.getUi()

var response = ui.prompt('May I know your name?', ui.ButtonSet.YES_NO)}
//Browser.inputBox('test')}

works perfectly for the owner but does not work for shared users. both inputBox and ui.prompt do not work for users when for example msgBox works perfectly. At the same time, it works for everybody if assigned to a button. so the problem is somewhere between onEdit, inputBox, and users. What can it be?

0

The last year Google introduced some restrictions to simple triggers like onEdit, onOpen and onInstall. Since then, simple triggers can't be used to open user interface elements like alerts and prompts for collaborators.

Instead of using a simple onEdit trigger use an installable on edit trigger or even better use a custom menu / button. It think that it's better to use a custom menu or button because these elements are relatively simpler.


From https://developers.google.com/apps-script/guides/triggers/

In certain circumstances, editor add-ons run their onOpen(e) and onEdit(e) simple triggers in a no-authorization mode that presents some additional complications. For more information, see the guide to the add-on authorization lifecycle.

NOTE: Bounded scripts are have the the same "certain circumstances" and "additional complications" as add-ons.

|improve this answer|||||
-1

This is standard behavior. Each user needs to authorize the script the same as you did in order to work for them. An option would be to set up an installable script triggered for each new user.

|improve this answer|||||
  • I already passed through this. even created a button for this script and with a button it works well for any user. but when comes to execute only based on onEdit - only for the owner. At the same time there are many other triggered scripts in this spreadsheet that work perfectly. only inputBox and ui.prompt do not show up. Same in another browsers – Marchuk Anton Jun 8 '19 at 21:31

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.