javascript - How to pass variable from client to server and persist it in the server for other functions -
in google appscripts web app, have variable defined in client (js) file. let's call variable qty. need variable in number of server functions, i'm doing this:
<script> google.script.run.serverfunction(qty); </script> and server script looks this:
function serverfunction(qty) { ... insert table (blah) values (qty); ... } but instead, want pass qty server once, set global variable (?) ... can use directly in server functions , not have pass client every time.
why need this? because currently, savvy user can run google.script.run.serverfunction(qty); in console , insert random things. figure if input variable set in server, there's more control.
you need use:
propertiesservice.getscriptproperties() and put data properties service. however, 1 property can hold 9k of data. if data on 9k, you'll need split up. if it's lot more 9k, 100k, might not work put data properties service. if need hold data less 6 hours, can use cache service, , store 100k in 1 property.
Comments
Post a Comment