Action Button Info

Hey all!

Anyone have additional info on using the custom widget template “Action Button”? I haven’t been able to find much info on how to use it, and don’t fully understand the syntax of the formula(s) used.

I’m hoping to be able to be able to use it to duplicate a record X number of times, so I’d be especially thankful for any tips on setting the button to do multiple actions/a single action multiple times!

Thanks in advance :slight_smile:

Apologies, it is indeed utterly undocumented. It exists as a workaround; hopefully we’ll have a better solution before long. The Action Button needs access to a column, with a formula that returns a value of this form:

    "description": "Some description text",
    "button": "Text of the button itself",
    "actions": [ACTIONS_TO_APPLY],

The actions field is a list of actions, having this form (for the most common kinds):

  ["AddRecord", "TableId", None, {"Col1": Value1, "Col2": Value2, ...}],
  ["UpdateRecord", "TableId", rowId, {"Col1": Value1, "Col2": Value2, ...}],
  ["RemoveRecord", "TableId", rowId],

The "actions" field should be a list of actions, and each action itself has the form of a list. So a single AddRecord action would look like [['AddRecord', 'MyTable', None, {"ColA": "ValueA"}]] (with two pairs of brackets).

There is an example of an Action Button to duplicate rows here:; it was used for a recent webinar.


Awesome, thanks!

Is there a way to make this work with reference columns? When I use the action button to duplicate a record, the new records have errors in reference columns (I just used “ReferenceColumn”: $ReferenceColumn in the action code)

Ah yes, $ReferenceColumn attempts to give you a useful object (e.g. to enable $Ref.Field notation), but for these actions you need the underlying numeric identifier. Try replacing $ReferenceColumn with either




Either one should fix it.

1 Like

How to you refer to a field in a different table in the dictionary of column values?

Also, what are the possible actions? I actually want the user to see the prompt for a reference list so she/he can pick the desired item–although ideally she would select a row in the source table to populate the row in the target table.

So many easy things are so hard when the plumbing just isn’t there for action. Grist is too much a spreadsheet with neither enough viewing flexibility, sensible navigation and actions beyond typing in cells.

I can’t get this to work. I sort of got it once, but the value in a target reference column had the right text but was not linked back to the source table.

Now, nothing works for the action button.

Here is the error:

"ActionButton" cells should contain an object with keys "button", "description", "actions". Missing keys: "button", "description", "actions"

Here is the formula from the action button:

{"description" : "Schedule a task", "button" : "Schedule", "actions" : [["AddRecord", "Details", None, {"Item": Routine_Maintenance.lookupOne(id=$id).cat}]]}

Looks like the dictionary has all 3 keys: description, button, actions. (Yes, there is an equal sign before the dictionary literal, but that won’t copy/paste.)

I’ve edited the formula multiple times to hopefully get it right. Clearly, I didn’t. I delete the widget to add it all over again because you only seem to parse the formula in the ActionButton column once when it is added. I got it work (incorrectly) once. Now it just never works at all.

I know you appreciate it when users show their undying gratitude for the great work you do, but sometimes the frustration is a bit much.

  1. Python formulas are essentially arbitrary code even when wrapped in a dictionary literal. There has to be a way to introduce cosmetic line breaks and to make the edit box larger. Even Excel allows both.
  2. Need a lot better documentation of the objects and functions that Grist exposes to Python.
  3. Widgets are fundamentally designed to be big rectangular areas that can hold a table, a card, a series of cards or a plot frame. How does a single little floating button get a huge rectangle for which the context is unclear? The button might apply to the document as a whole, but it might also apply to a row, in which case it should be the rendered value inside a column – not unlike a choice item.

Sorry, but 3 hours later for something like this has me wondering if you should release features in such raw state just to get marketing credit for having the feature. Don’t you want the feature to be usable before you release it?

So many things in the design of this product are very well thought out from the beginning (like granular permissions). As you scramble to keep up in the feature battle don’t succumb to “featuritis” just adding things by cramming them in. Better to delay and get it right than get it wrong–that’s worse than no feature at all. Hard discipline when competition in this category is truly frantic.

Well, I got the button to appear and perform an action.

It always selects row 1 of the referred to table instead of the last row selected.

So, it always fills in the same text and it doesn’t not return a reference link, which is what I must have.

@Lewis_Levin, your source data table must be selected in the “SELECT BY” custom widget option, and then the custom widget will use the selected row

1 Like