Is it possible to mark a record (formula checkbox) when it has been 'saved as spreadsheet'?

  • 0
  • 1
  • Question
  • Updated 8 months ago
  • In Progress
I have a table that I need to track when records are 'saved as spreadsheet' by end users. This would enable me to create some automation's related to this activity.
Photo of Jason

Jason

  • 1,012 Points 1k badge 2x thumb

Posted 8 months ago

  • 0
  • 1
Photo of Avi Sikenpore

Avi Sikenpore

  • 532 Points 500 badge 2x thumb
Rather than allowing users to natively save as a spreadsheet, you can give them an icon/button to download. It would essentially be a url link to a report where the format of the report is set to csv. 

So prior to directing them to the URL, you can make an api add record call and log that info in a field which puts a timestamp and user info. And you formula checkbox can be driven off that field.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,522 Points 20k badge 2x thumb
This is easy to do with a Service Worker. You can arrange for a Service Worker to detect when a particular pattern of URL is requested and take the appropriate action. In the case of Save as spreadsheet a URL is fetched that has the following query string:

?a=q&qid=1&dlta=xs~

Although a Service Worker has the ability to (1) modify or (2) substitute either the request or response in this case we will do neither and simply make a supplemental call to API_AddRecord recording the dbid and qid to a logging table. It is a ridiculously simple script to do what you ask.

There seems to be a lot of confusionfear and loathing over the role of using Service Workers with QuickBase. The best minds in the industry have contributed to the development of the Service Workers API and they are safe to use and extremely useful. Developers are simply unaccustomed to using Service Workers as the capability has never existed before so they have no similar experience to draw on.

All browsers have support for the Service Worker API at this point (Apple is the last holdout but has support in Safari 11.1) and the Service Worker API has been adopted by several cloud service companies as part of their Edge Computing initiatives. This includes Cloudflare where they have adopted the Service Worker API and named it CloudFlare Worker which operate at the edge.

Cloudflare Workers
Run code at the edge, deliver powerful web extensibility
https://www.cloudflare.com/products/cloudflare-workers/
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,522 Points 20k badge 2x thumb
Visit this demo page:

Log Spreadsheet Downloads
https://haversineconsulting.quickbase.com/db/bnius2h9z

You now have a Service Worker registered. I authored the page and you have no choice in the matter.  Service Workers are considered to be part of the authored page and they are constructed to perform a helpful task when users interact with my page - namely to log spreadsheet downloads. Unlike for example geo-location - which gives up user information and requires permission to be granted - Service Workers do not require permissions as they don't in themselves deal with user information.

Now visit any of these reports and proceed to download as a Spreadsheet:

List All
https://haversineconsulting.quickbase.com/db/bnius2ia3?a=q&qid=1

List Changes
https://haversineconsulting.quickbase.com/db/bnius2ia3?a=q&qid=2

By Factor
https://haversineconsulting.quickbase.com/db/bnius2ia3?a=q&qid=5

By Environment
https://haversineconsulting.quickbase.com/db/bnius2ia3?a=q&qid=6

You will get the report downloaded as normal. However, if you visit the Logs table you will now see you have create a log entry reflecting your selected report.

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

Notes:

(1) This demo was developed very rapidly while watching the local news. There are some things I would do slightly differently for a production application but at this point it is probably most important to understand what Service Workers can do.  These suckers are extremely powerful and they are rightly called god mode for QuickBase.
(Edited)