My favorites | Sign in
Project Home Wiki Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 535: User defined paramter in Script URL for Apps Script gadget in Sites
47 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  sagu...@google.com
Closed:  Jan 2012


Sign in to add a comment
 
Project Member Reported by sagu...@google.com, Apr 13, 2011
Request Summary:
1. Write this script
function doGet(e)
{
  var app = UiApp.createApplication();
  var site = SitesApp.getActiveSite();
  var label  = app.createLabel(e.parameter.test);
  app.add(label);

  return app;
}


2. Execute it as  standalone app with
https://sites.google.com/macros/exec?service=AKfycbxD7n9h2PTUuEtv_OhbSyjVQizcR4vdNTc&test=testing

3. Execute from Sites Page
https://sites.google.com/site/appsscriptforum/userdefined-param?test=ThisTest

The script embedded in Sites page is not able to read the parameter in the URL.


Apr 15, 2011
Project Member #2 sagu...@google.com
(No comment was entered for this change.)
Summary: User defined paramter in Script URL for Apps Script gadget in Sites
Apr 27, 2011
#3 ada...@calvinseminary.edu
If a script is to be used on multiple sites, a user parameter entered when the gadget is added to the site gives a way to make a general script, but still have some site specificity.
Jun 5, 2011
#4 kyawt...@gmail.com
SitesApp.getActiveSite(); is very useful for site apps
Jun 6, 2011
#5 ada...@calvinseminary.edu
It would be if it worked. Currently it does not work.
Jun 6, 2011
#6 kyawt...@gmail.com
Probably those running on server side do not work.
Jun 6, 2011
#7 ada...@calvinseminary.edu
It does not work in a gadget in a site. Create a simple Google Apps Script. Add it to a site as a Google Apps Script Gadget. getActiveSite does not work. It not working is a major problem.
Jul 20, 2011
#8 george.t...@omnisourcetech.com
Providing such capabilities for gadgets to receive URL parameters in google sites allows the basis of navigation through pages containing gadgets. As an example, if i want to create one page displaying a list of items, I would be very happy to navigate to a new page in the site dedicated to editing (or adding) items. 
Sep 1, 2011
Project Member #9 sagu...@google.com
(No comment was entered for this change.)
Status: 5248569
Nov 18, 2011
#10 peter.ri...@age-systems.com
What does "Status 5248569" mean ? Are you including this feature ?
In Sites scripts open the door to complex web app creation if we could send them some parameters !!
Nov 24, 2011
#12 k-oha...@bfts.co.jp
 I use iframe gadgets or I edit page's html content and append iframe tag for this problem ,if I need script embedded in Sites page with parameter.

but I cant use "SitesApp.getActiveSites()" for this case in script.
Jan 12, 2012
#13 asora...@google.com
(No comment was entered for this change.)
Labels: -Component-OtherServices Component-SitesService
Jan 12, 2012
#14 asora...@google.com
This issue has been fixed.
Please confirm that it is working for you.

Best,
Anton
Status: Fixed
Sep 12, 2012
#15 tans...@gmail.com
this works, for me, but what i'd like to be able to do is pass the parameter within the google app script url in the google gadget so I didn't have to expose the parameters quite so publicly.  When I put a URL like:

https://sites.google.com/macros/exec?test=testing

into the google app script gadget, the test parameter gets removed :-(
Oct 12, 2012
#16 rob.bis...@theangleseyarms.co.uk
I'm having the same trouble, URL query parameters are not passed when hosted in a Google Apps script gadget, but works fine when you enter the URL into a browser. I used the following work around:

function doGet(e) {
  var activePage = SitesApp.getActivePage(),
      title = activePage ? activePage.getTitle() : '';

  if (e.parameter.page === 'mypage' || title === 'mypage') {
  } else {
   ...
  }
}

HTH
Nov 6, 2012
#17 jeremy.r...@revevol.eu
Hi, I don't see how your work around could enable to pass a specific parameter value (in the Googla Appscript gadget URL) for each time I "deploy" my script in a different Gsite.

that hasn't been fixed for now?

What about using an iframe to embed the script in the Gsite? Still doesn't work
Nov 16, 2012
#19 dyf...@gmail.com
I have a gadget embedded in a Google Site. The gadget URL which is embeded is similar to https://sites.google.com/macros/exec?service=9ux5v-E0nZuqYbJIwwCHbcwQ&app=scores

function doGet(e) {
  var appParam = e.parameter.app;
  ....
}

appParam = "scores"

This works for me. I just change the parameter value each time you embed the script on a different page.
Apr 29, 2013
#20 marcus.e...@gmail.com
I am a Google Apps for business user, the following Google Apps web app script URL works fine from the browser (parameters modified for privacy reasons):
https://script.google.com/a/macros/mydomain.com/s/AKfyc...jjD-Y/exec?listConfigSpreadsheet=0AlMo...1wZXc&listForm=Form01&listDataSpreadsheet=0AlM...VxVVE&numberDataSet=0&userActionDesctiption=Add_new&language=1
When I use the same URL in Google Sites Apps Script Gadget, the parameters are not passed to the script/web app.
Is the bug still around or am I doing anything wrong?
May 6, 2013
#21 dbingham...@gmail.com
Re comment #20.

There is apparently an issue with the apps script gadget in Sites, as parameters after the URL are not being passed.

As a work-around, I've found that I can use the URL of the Site Page itself - in my case, I had several dozen pages that were going to invoke the same script with a parameter to tailor the queries performed to populate a DataTable.

function doGet(e) {
  var customQuery = e.parameter.customQuery || '';
  // Work around for https://code.google.com/p/google-apps-script-issues/issues/detail?id=535
  var pg = SitesApp.getActivePage();
  var pgURL = '';
  if ( pg !== null ) pgURL = pg.getUrl();
  // Now disassemble pgURL to figure out what the query should be
  ...


Apr 18, 2014
#22 jphthier...@gmail.com
nice trick; I am in the same situation. A shame though that parameters are not passed.
Sign in to add a comment

Powered by Google Project Hosting