Adding a custom button (and related actions) that will always show on a table based on a slice

I am trying to add a button to “Send Order” to an “Order” UI that is displaying a slice of data from an Google Sheet “Inventory” table.

The underlying “Inventory” Google sheet includes 3 relevant columns, “Current Stock Level”, “Minimum Stock Level” and “Order Amount”. The “Order Amount” column is automatically calculated by a formula in the google sheet that calculates the difference between the “Minimum Stock Level” and the “Current Stock Level”.

There are multiple rows in the Inventory table, but only those with a “Current Stock Level” lower than the “Minimum Stock Level” will need restocking. The slice limits the table to only those items that have a positive order amount (i.e. the “Current Stock Level” is lower than the “Minimum Stock Level”).

This table and the slice are working perfectly - it is only showing those rows that need to be restocked, along with the calculated “Order Amount”.

I now want to add a button that will appear on the Table view whenever at least one row needs to be restocked (i.e. the slice includes at least one data row).

When the button is clicked, I want it to create a CSV and PDF file containing all of the rows in the table (limited by the slice). These files to be formatted based on a template. I then want an email to be created and sent to the user’s email address, with the CSV file and the PDF attached. Ideally, I would like the user to be able to choose who to send the email to (from a list of users in a user’s table).

I don’t want the user to have to click a row on the table in order to have the button appear. I want the button to always be visible, as long as there is at least one row visible in the slice.

Is there any way to achieve what I want - I’m really struggling to see how to

  1. Create a button with a custom description and icon that will appear on a table view of a slice
  2. Make the button appear without the user having to click a row etc.
  3. Make the button disappear if there are zero rows visible in the slice.
  4. Have the button create a CSV file containing all the columns and rows in the slice, in a pre-defined format.
  5. Have the button create a PDF file containing all the columns and rows in the slice, in a pre-defined format.
  6. Allow the user to select who to send the email to from a list of users in the user table.
  7. Create an email to the chosen user, attach the csv and pdf to it and send it.
  8. Confirm to the user that the process has completed successfully.

I can kind of see how to do 4-8 from some of the online examples, but I’m stuck on steps 1-3, so any help would be greatly appreciated.

Thanks in advance!

You’d have to include a selection somewhere for the user to do this. Perhaps in their user settings?


Many thanks for the replies Marc, but I still seem to be having problems.

I set the behaviour action as indicated and it seemed to make the button icon appear as hoped the first time. Unfortunately, that stopped as soon as I resynched and I can now only get the action button to appear when the user selects at least one row, no matter what settings I use on the behaviour/actions.

I have tried to get my head around the automation, but I just can’t make any useful progress. Perhaps if I limited my question more.

I have 3 tables, “Inventory Items”, “Order Header” and “Order Inventory”. The Inventory Items table contains multiple inventory items, some of which have a Packs To Order column with a value greater than 0.

Ideally, I want a “Send Order” button to always be visible on the Inventory Items view.

Clicking this button should do the following:

  1. Insert a new row into the Order Header table, auto generating a uniqueid for the Order Number column on the new row. Set the Status column of this new row to “Pending”.

  2. Copy all records with a Packs To Order value > 0 from the Inventory Items table to the Order Inventory Table, setting the Order Inventory.Status column to “Pending”.

  3. Update the Order Number column all of the records on the Order Inventory table with a blank Order Number and Status = “Pending” to be the most recent order number from the Order Header table (I assume I can retrieve this with a select and then pass it to the update row operation?).

  4. Create a PDF document containing the Order Header and Order Inventory child items for all Order Header records with a Status = “Pending”. Use a pre-defined template to make this PDF pretty.

  5. Create an email, attaching the PDF to it.

  6. Send that email to a pre-defined email address.

  7. Update the Order Header.Status for all records with Status=“Pending” to “Sent”.

  8. Update the Order Inventory.Status for all records with Status=“Pending” column to “Sent”.

Although it is a lot of steps, it shouldn’t be that hard to do…should it?

I made no progress with the above, so I thought maybe I could just use an Action associated with the Order Header table, so that when a new record is added to it, I then trigger something (anything). Unfortunately the only option I’m allowed for “Data Change” appears to be “Delete”. There are no other actions available on the task creator, even though the table has all of the normal Add Update Delete actions listed for it.

Am I being really dense here or is this something that either just doesn’t work properly or is being artificially limited/crippled as I only have the free license and/or my app is only in prototype?

At the moment, I can’t even set up a Task

Honestly, this is far too much to respond to. You really need to learn some of the stuff yourself and narrow down the issues that you really can’t figure out, then post those specific questions (or better, search for the answers). Either that or try and hire someone to help you personally (I can assist you in this regards if required).