Skip to main content
Forest’s real power comes from the business logic you add on top of your data. This step covers the two most common building blocks: actions and computed fields.

Create your first action

Actions are custom operations your team can trigger from the UI, refunding an order, sending an email, flagging a record for review. You define them in your back-end code, so they can call external APIs, update multiple tables, or trigger any side effect you need. Add an action to a collection in your back-end:
agent.customizeCollection('orders', collection =>
  collection.addAction('Mark as reviewed', {
    scope: 'Single',
    execute: async (context, resultBuilder) => {
      await context.collection.update(context.filter, { status: 'reviewed' });
      return resultBuilder.success('Order marked as reviewed');
    },
  }),
);
Restart your back-end and the action appears in the collection’s Actions menu.
Actions can have forms with dynamic fields, approval workflows, and granular permissions. See Code-based actions for the full reference.

Create a computed field

Computed fields let you display values that don’t exist directly in your database, a full name from first and last name, a status derived from multiple columns, a formatted price. Add a computed field the same way:
agent.customizeCollection('customers', collection =>
  collection.addField('fullName', {
    columnType: 'String',
    dependencies: ['firstName', 'lastName'],
    getValues: records => records.map(r => `${r.firstName} ${r.lastName}`),
  }),
);
Restart your back-end and the field appears in your back-office like any other field.
Computed fields can also be made writable, filterable, and sortable. See Fields.

What’s next

With actions and computed fields in place, you’re ready to build higher-level operational tools: workspaces, workflows, and inboxes.

Next: Set up operations →

Build workspaces, workflows, and inboxes for your team