Loren Saunders
Loren Saunders

Reputation: 1

Installed trigger causing permissions error for Browser.inputBox even when script is authorized

I have a Google spreadsheet with a function: appendComment that is attached to the onEdit installable trigger for the sheet.

Permissions for the sheet are set to both link sharing (anyone with link has edit permission) and specific users with edit access.

  1. setting up:
    I have a menu item added in the onOpen trigger which starts the script permission process, giving permission for the scripts to run for that user. It is a simple MsgBox call inside a function called getAuthorization. To initiate authorization for the scripts in the sheet, the user selects the only item from the "SCG" menu, which initiates the process.

  2. the problem:
    After authorizing the script, I make the trigger fire by clicking on a checkbox in a cell on the sheet (the appendComment function only operates when I click in that column), I get a permissions error that looks like this:

You do not have permission to call prompt (line 30, file "")

This is infuriating... can't find this problem and its resolution anywhere.

Both Browser.inputBox and ui.prompt cause the same error.

Here is a simple reproduction of the problem in a google-sheet for anyone who wants to take a look: https://docs.google.com/spreadsheets/d/1WxVTulbqT8dtUlHEf_TW_Jaus5a1GSfXnjgdoWYhrls/edit?usp=sharing

Any help is appreciated!

Upvotes: 0

Views: 147

Answers (1)

Loren Saunders
Loren Saunders

Reputation: 1

To achieve the result I was going for... controlled comments history with easy comment entry by users on a sheet... I did away with the prompt boxes and just used the adjacent cell instead.

Ended up putting my function in the onEdit trigger.

No box neededed, no permission issues, works even better than with the checkbox.

Upvotes: 0

Related Questions