Search code examples
google-app-maker

Integrate url parameters


Is there a way to construct a local link with parameters that will work in both test and prod? I was planning to hard code it but realized the first part of the link being different would cause problems. (yes, I can create a script variable but that isn't ideal).

By this I mean links that end with #Files?id=100


Solution

  • Yes there is! You need to use this on the server script:

    var appUrl = ScriptApp.getService().getUrl();
    appUrl += "#Files?id=100;
    

    Reference: https://developers.google.com/apps-script/reference/script/service#getUrl()