steedos-server-logic

Implements server-side triggers and functions for Steedos object record lifecycle events.

1.6k|414|Updated Mar 4, 2019
One-click install
npx skills add https://github.com/steedos/steedos-platform --skill steedos-server-logic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: steedos-server-logic
Source: https://github.com/steedos/steedos-platform/tree/main/skills/steedos-server-logic
Command: npx skills add https://github.com/steedos/steedos-platform --skill steedos-server-logic

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It automates server-side business logic in Steedos applications, such as validating records, auto-filling fields, cascading updates, and exposing custom REST API functions, without manual coding of backend services.

Core Features & Use Cases

  • Triggers (.trigger.yml): Run JavaScript handlers on record lifecycle hooks like beforeInsert, afterUpdate, and beforeDelete for validation, auto-fill, and cascade operations.
  • Functions (.function.yml): Define reusable server-side scripts exposed as REST endpoints at /api/v6/functions/{objectApiName}/{functionApiName} for actions like approvals, batch processing, and ERP synchronization.
  • Shared Sandbox Context: Access ctx.params, the objects API for CRUD, npm utilities (lodash, moment, axios), and the MongoDB db client inside handlers.
  • Use Case: When an order's status changes to approved, a trigger can notify the owner while a function syncs the order to an external ERP system via HTTP.

Quick Start

Create a beforeInsert trigger on the orders object that validates the amount is positive and auto-fills the order date.

Frequently Asked Questions about steedos-server-logic

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a trigger in Steedos?

Create a .trigger.yml file in the main/default/triggers/ folder with name, listenTo, when, isEnabled, type set to code, and an inline JavaScript handler. The name must start with the listened object's API name prefix, such as orders_validate.

How do I expose a Steedos function as a REST API?

Set is_rest to true in the .function.yml file. The function becomes available at /api/v6/functions/{objectApiName}/{functionApiName}, where functionApiName is the function name with the object prefix removed.

What trigger events does Steedos support?

Supported events are beforeInsert, afterInsert, beforeUpdate, afterUpdate, beforeDelete, afterDelete, beforeFind, afterFind, afterFindOne, afterCount, beforeAggregate, and afterAggregate. Values outside this list cause the trigger to fail silently.

How do I avoid infinite loops between Steedos triggers?

Use objects.directUpdate or objects.directInsert instead of update and insert when modifying records inside a trigger. The direct methods bypass other triggers, preventing recursive execution.

Why is my Steedos trigger not running?

Common causes are an invalid when event value, type not set to code, isEnabled set to false, or a name missing the listenTo object prefix. Also verify the file is in main/default/triggers/, not inside the object folder.