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!

0 3 7,739
3 REPLIES 3

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).

Top Labels in this Space