Manage backend scripts, event triggers, and scheduled tasks in Timill Platform.
Script Management#
Creating Scripts#
- Navigate to Group Settings → Scripts
- Open the script editor and choose an automation (Manual or Schedule) or an item script (Save Hook or Menu)
- Write the JavaScript code
- Configure the trigger — a cron expression for Schedule, an icon for Menu, field conditions for Event / Save Hook / Menu
- Save
Backend scripts are JavaScript only. See Backend scripts for the full walkthrough — what each trigger runs as, what globals it gets, and how writes behave (immediate vs. staged in a save hook).
Script Types#
| Type | Trigger | Use Case |
|---|---|---|
| Manual | Execute on demand | One-time operations, bulk cleanups |
| Schedule | Cron expression | Daily reports, recurring cleanup tasks |
| Event | Item events | Auto-assign, notifications, webhooks |
| Save Hook | Runs as part of saving an item of its bound type | Validation, computed fields |
| Menu | Run on demand from an item’s context menu | One-off actions a person triggers, e.g. “create follow-up task” |
Note
The script editor’s trigger buttons only offer Manual, Schedule, Save Hook and Menu directly. An Event script is created via the scripting AI assistant; once it exists it opens and edits normally like any other script.
Viewing Execution History#
- Go to Group Settings → Scripts
- Click on a script to view its execution history
- Check logs — everything passed to
log()/console.log()— for output and errors
Event Triggers#
Available Events#
Pick Event in the script editor’s trigger buttons, then choose what runs the script:
| Event | Fires when |
|---|---|
An item is created (CREATE) | An item is created, including through a form or an import |
A field is changed (FIELD_UPDATE) | Any field of an item is saved with a new value |
An event script can listen to items of every type or be limited to one, and can carry field-level conditions, built in the editor, that further restrict when it fires — for example, only when the status changes to Done, rather than on every change. It runs in the background after the save, as the person who made the change.
Event scripts are reserved to group administrators: the configuration assistant in group administration can also create and edit them, but the Timill assistant cannot.
Scheduled Tasks#
Cron Expression Format#
Schedules use standard 5-field cron — there is no seconds field:
┌───────────── minute (0–59)
│ ┌───────────── hour (0–23)
│ │ ┌───────────── day of month (1–31)
│ │ │ ┌───────────── month (1–12)
│ │ │ │ ┌───────────── day of week (0–6, Sunday = 0)
│ │ │ │ │
* * * * *
@hourly, @daily, @weekly, @monthly and @every 30m are also accepted. Schedules run in the server’s local time zone unless the expression carries its own (CRON_TZ=Europe/Paris 0 7 * * *).
Common Examples#
| Schedule | Cron Expression | Description |
|---|---|---|
| Every hour | 0 * * * * | Run at the start of each hour |
| Daily at 9 AM | 0 9 * * * | Run daily at 9 AM (server local time) |
| Weekly on Monday | 0 9 * * 1 | Run every Monday at 9 AM |
| Monthly on 1st | 0 9 1 * * | Run on the 1st of each month |
| Every 5 minutes | */5 * * * * | Run every 5 minutes |
| Weekdays at 7 AM | 0 7 * * 1-5 | Run Monday through Friday |
A scheduled script never overlaps itself: if the previous run is still executing when the next tick is due, that tick is skipped rather than queued.
Security Considerations#
Script Permissions#
- A script runs as its acting user — who that is depends on the trigger (the person who clicked Run or the menu entry, the acting user of the triggering save/event, or the script’s own author for a schedule) — and every read and write is checked against that user’s permissions, exactly as if they had made the change by hand.
- Group admins can create and modify scripts in their own groups.
- Instance admins can manage scripts across all groups.
Secrets Management#
Scripts can access encrypted secrets via secrets.get(), JavaScript backend scripts only:
- Navigate to Group Settings → Secrets
- Add secret keys and values
- Access in scripts:
secrets.get("API_KEY")— returnsnullif the key isn’t found
See Secrets for the group→instance fallback and other details.
Limits#
| Script kind | Timeout | Max API calls | Max memory |
|---|---|---|---|
| Backend scripts (manual, schedule, event, menu) | 30 seconds | 100 | 50 MB |
| Save hooks | 5 seconds | 100 | 50 MB |
| Scripted widgets | 10 seconds | 50 | 25 MB |
| Scripted charts | 10 seconds | 50 | 25 MB |
Only fetch() and secrets.get() count against the API call limit — group.queryItems() and every other read or write does not. Scripted widgets (Gonja) have no fetch or secrets access at all, so their limit is mostly a timeout/memory ceiling in practice.
Monitoring#
Execution Logs#
View script execution logs:
- Group Settings → Scripts → [Script] → Execution History
- Check for errors or unexpected output
- Monitor execution times
Performance Tips#
- Keep scripts small and focused.
- Bound
queryItemscalls with a specific filter (a date range, a status) rather than sweeping every item in the group. - Schedule heavy tasks during off-peak hours.
- Monitor API call usage — remember only
fetch()andsecrets.get()count toward it.
Troubleshooting#
Script Not Running#
- Verify the trigger configuration (cron expression, event actions, conditions).
- Check the script syntax — a syntax error is rejected at save time, so a script already saved should be syntactically valid; check the execution history for a runtime error instead.
- Review execution logs.
- Confirm the acting user for this run actually has permission to make the change the script attempts.
Timeout Errors#
The script exceeded its timeout (30 seconds for backend scripts, 5 seconds for save hooks, 10 seconds for widgets/charts). Reduce query complexity, narrow the query, or split the work across multiple scripts.
API Call Limit Exceeded#
Review the script to reduce fetch() / secrets.get() calls:
- Fetch what’s needed in fewer requests instead of one call per item.
- Cache a secret’s value in a local variable instead of calling
secrets.get()repeatedly. - Batch operations together.
See also:
- Scripting Overview — All scripting environments
- Backend scripts — Triggers, globals, write semantics, examples
- JavaScript API reference — Complete API docs
- Query language — The syntax
group.queryItems()takes