Edo
Edo

Reputation: 1589

Is it possible to share access to dev version of a script deployed as a Web App?

I'm working on a GAS deployed as a Web App. I can share the script and let others edit it, but I can't find a way to let them test the web app.

The link from "Test web app for your latest code." is available only to the owner of the script.

Am I missing something ?

Upvotes: 0

Views: 152

Answers (3)

Mogsdad
Mogsdad

Reputation: 45720

You can use the supported way to deploy Google app script as a web service: create new versions and publish them, then all editors can access the app by its deployment URL(s). This allows all editors to test the latest published version, but not the latest edited version.

The cons of this approach:

  • Two steps required for every re-publication. (Manage Versions / Create, then Deploy.)
  • Your app must be publicly accessible.

The pros:

  • Once published as a web app, the URL does not change, so everyone sees the latest copy by simply reloading.
  • You can easily republish previous versions for side-by-side comparison testing.

Upvotes: 3

Bryan P
Bryan P

Reputation: 5051

UPDATE: Looks like this is available now - via Release Notes "If a script is shared with editors other than its owner and published as a web app, those other editors can now update the app's version and access its development URL (which ends in /dev)."

... OLD WORKAROUND: You could connect another script file into your main one as a workaround. In the second script, import the main one as a library in Dev mode. When you save, publish and share the exec link of the second it'll be like sharing the dev link.

Master script

function doGet() {
  var app = UiApp.createApplication();
  var btn = app.createButton('Click').setId('btn');
  var box = app.createTextBox().setId('box').setName('box').setText('hello');

  var handler1 = app.createClientHandler().forEventSource().setEnabled(false);
  var handler2 = app.createServerHandler('change').addCallbackElement(box);
  btn.addClickHandler(handler1).addClickHandler(handler2);

  app.add(btn).add(box);
  return app;
}

function change(e) {
  var app = UiApp.getActiveApplication();
  var box = e.parameter.box;
  app.getElementById('btn').setText(box).setEnabled(true);
  return app;
}

Second script (after importing Master script as a library and naming the identifier as 'master')

function doGet() {
  var app = master.doGet();
  return app;
}

Upvotes: 3

Corey G
Corey G

Reputation: 7858

It is not currently possible to share that.

Upvotes: -1

Related Questions