How To Create Dashboard Script Buttons?

  • 0
  • 1
  • Question
  • Updated 5 months ago
  • Doesn't Need an Answer
  • (Edited)
How To Create Dashboard Script Buttons?

QuickBase does not make is easy to run script from the dashboard but here is a simple solution.

First the demo:

Just click one of the three buttons on the dashboard and the associated script file saved in a code page will run:



Dashboard Script Buttons
https://haversineconsulting.quickbase.com/db/bns3puc3s

To set this up for yourself just create three code pages:

Code Page: alert1.js
https://haversineconsulting.quickbase.com/db/bns3puc3s?a=dbpage&pagename=alert1.js

Code Page: alert2.js
https://haversineconsulting.quickbase.com/db/bns3puc3s?a=dbpage&pagename=alert2.js

Code Page: alert3.js
https://haversineconsulting.quickbase.com/db/bns3puc3s?a=dbpage&pagename=alert3.js

Make sure to give each of your buttons the display text using the name of the code page and include the .js suffix (ie alert1.js, alert2.js, alert3.js)

Now add a button on the dashboard for each of these code pages using the same procedure you would to add a button to an HTML page.

Finally, add a web page widget named script.html (this is a HTML page not a JavaScript page) to the bottom of your dashboard using the code in the pastie below:

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=670

When this script.html page loads (in its iframe) it will scan all your buttons and convert those buttons that point to code pages named *.js to load the associated script file rather than load the code page for viewing. This demo uses the new Dashboard Widget Script (DWS) technique.

Once setup the file script.html will convert any new buttons you add that are named after the code page containing script.

Notes:

(1) As a practical matter all of your code in the inject page should be included within a closure so it does not conflict with QuickBase's code.

(function(){
  alert("alert1.js");
})();

Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,572 Points 20k badge 2x thumb

Posted 5 months ago

  • 0
  • 1

Be the first to post a reply!