Forum Discussion
_anomDiebolt_
7 years agoQrew Elite
>Can I access system variables through javascript?
Of course you can! JavaScript can access everything and is your portal to a happy, bountiful and successful life.
In the pastie below I define a function with the following signature:
In the Pastie Database I created a new application variable foo and gave it the value bar. So if you visit the Pastie Database and paste the code into the console you will get the following output:
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=680
Notes:
(1) This script is written in a very specific style to make the code as short as possible and uses some advanced JavaScript features including ES6 Promises.
(2) The script converts the jQuery promise to an ES6 promise to get around a bug in jQuery 1.71 which QuickBase uses which prevents proper chaining.
(3) The coding for setDBVar would be very similar but would use a function with the following signature:
Of course you can! JavaScript can access everything and is your portal to a happy, bountiful and successful life.
In the pastie below I define a function with the following signature:
getDBVar(dbid, varName) { ...}When you call it a promise is returned which when it resolves returns the value of the varName.
In the Pastie Database I created a new application variable foo and gave it the value bar. So if you visit the Pastie Database and paste the code into the console you will get the following output:
foo = barPastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=680
Notes:
(1) This script is written in a very specific style to make the code as short as possible and uses some advanced JavaScript features including ES6 Promises.
(2) The script converts the jQuery promise to an ES6 promise to get around a bug in jQuery 1.71 which QuickBase uses which prevents proper chaining.
(3) The coding for setDBVar would be very similar but would use a function with the following signature:
setDBVar(dbid, varName, varValue) { ...}
KenCasser
7 years agoQrew Cadet
Thank you! I appreciate your help!