Skip to content

Salesforce ORM Documentation

⚠️ DEPRECATION NOTICE: The string-based Model class and QueryBuilder are deprecated and will be removed in v2.0.0. Please migrate to LambdaModel. See Migration Guide.

Welcome to the Salesforce ORM documentation! This library provides a type-safe, lambda-based query interface for Salesforce with full closure variable support.

Getting Started

New to the library? Start here:

Models

Learn how to define and generate models:

Querying

Master the query API:

CRUD Operations

Work with Salesforce records:

Advanced Topics

Deep dive into advanced features:

CLI Tools

Command-line utilities:

Reference

Key Features

Type-Safe Lambda Queries

const accounts = await Account
  .select(x => ({
    Id: x.Id,           // ✓ IntelliSense
    Name: x.Name        // ✓ Type-checked
  }))
  .limit(10)
  .get();

Closure Variables

const industry = 'Technology';

const accounts = await Account
  .select(x => ({ Id: x.Id, Name: x.Name }))
  .where(x => x.Industry === industry)  // ✓ Closures work!
  .get();

Relationship Queries

const activeStatus = true;

const accounts = await Account
  .select(x => ({
    Name: x.Name,
    Contacts: x.Contacts
      .select(c => ({ Name: c.Name }))
      .where(c => c.Active__c === activeStatus)  // ✓ Closures in subqueries!
  }))
  .get();

Important Notes

⚠️ Governor Limits: This library does NOT automatically handle Salesforce governor limits. Always use .limit() and proper filtering.

⚠️ Observers: Observers are JavaScript/TypeScript hooks that run in your application, NOT Salesforce Triggers, Process Builder, or Flows.

Need Help?