Scripts
Scripts API
Write Antly scripts for records, tasks, tickets, and workflow script nodes.
Scripts let tenant builders run controlled code inside Antly. They are used from object scripts and workflow script nodes, and they execute with tenant context around an Antly model instance or workflow payload.
The current script-enabled models are:
objects.Recordtasks.Tasktickets.Ticket
Object scripts are stored as objects.ObjectScript rows. They belong to an object, have a trigger, contain the script source, and can be published, approved, and configured to raise_error_on_failure.
Object script shape
1{
2 "__meta__": {
3 "schema": "model",
4 "namespace": "objects.ObjectScript",
5 "intent": "create",
6 "authenticationClass": "jwt",
7 "return": {
8 "id": null,
9 "name": null,
10 "trigger": null,
11 "published": null,
12 "approved": null
13 }
14 },
15 "object": 42,
16 "name": "Set priority on save",
17 "description": "Marks large enterprise records as high priority.",
18 "trigger": "on_save",
19 "script": "if instance.data.get('account_type') == 'enterprise':\n instance.data['priority'] = 'high'\n instance.save()",
20 "raise_error_on_failure": true,
21 "published": true
22}The exact trigger values are defined by the object script trigger enum in the product. In the UI, use the object script editor and playground described in /guides/object-scripts.
Testing scripts
The object controller includes a test_script action for validating a script against a selected record. Frontend script testing is restricted to Antly owner accounts. Tenant builders normally test through the product playground rather than calling this controller directly.
1{
2 "__meta__": {
3 "schema": "controller",
4 "namespace": "objects.Object",
5 "intent": "test_script",
6 "authenticationClass": "jwt",
7 "return": {
8 "result": null
9 }
10 },
11 "script_id": 123,
12 "record_id": 456
13}Execution guidance
Write scripts as small, deterministic units. Read the current instance, compute the change, write the minimum fields, and fail loudly only when the business process should stop. Use raise_error_on_failure for rules where a failed script must block the save or workflow step.
When a script needs richer orchestration, move it into a workflow and use a script node in context. See /developer/script-patterns, /guides/scripts, and /guides/workflow-studio.