Automation Rule with Pyhon Script

Hi SeaTable Team,

Currently I have two problems with the feature Automation Rule:

  1. We want to allow an event to be scheduled int the future optionally. Therefore I add 2 trigger rules with a script for a table. Two columns status and execution_date of this table are used for the conditions when the script is run. We use the context to get the current triggered row ( context.current_row)

Two automation rules are:

  • Rule 1: status=ready and execution_date is empty + event Records meet specific conditionals after modification. It is intended to run the script at any time if the conditions are fulfilled.

    => It works :slight_smile:

  • Rule 2: status=ready and execution_date is today + event Run periodically on records meet conditions everyday on e.g. 6:00. We can set the execution_date in the future and schedule to run the script in some rows.

=> No python runner container was started in my case, I used the command watch n -1 docker ps -a and observed at the time on server and in the SeaTable UI (they are different) . When I clicked on Run now in the rule settings (see the above screenshot), the python runner container was started normally and the following error occurred in the container:

row:  None
Traceback (most recent call last):
  File "", line 500, in <module>
  File "", line 48, in test_script
    row_id = row["_id"]
TypeError: 'NoneType' object is not subscriptable

The code in script is (it works in Rule 1):

from seatable_api import context
row = context.current_row
row_id = row["_id"]

The context environment seems to be not used for this case.

Could you tell me, what I did wrong or how could I fix the script to get the triggered rows?
Another question: I notice, the time on the server and in the seatable container are the same but they are different from the time in SeaTable UI. Which time is actually used for the execution Run periodically on records meet conditions ?

  1. I can’t reproduce an automation rule like Rule 2 anymore, even with another table or in another base. The action option with Run Python script is unavailable, just only Lock records. Why can it happen?

We use SeaTable Version 2.7.9 Enterprise.
I’m looking forward to your answer. Thank you very much :slight_smile: