Autorun AI Docs
Process DesignerBusiness FunctionBusiness Functions Reference

1. Create Record


create(slug, values [, options])

async · returns Entity

Creates a single new record. This is the primary, recommended way to insert records.

Prop

Type

const newRecord = await context.functions.create("invoices", {
  ClientName: "Acme Corp",
  Amount: 1500.00,
  Status: "draft"
});
const newRecord = await context.functions.create(
  "invoices",
  { ClientName: "Acme Corp", Amount: 1500.00 },
  { skipTriggers: true }
);

Returned value — the full Entity with custom and system fields:

"Attributes": {
  "ID": "84",
  "ClientName": "Acme Corp",
  "Amount": 1500.00,
  "Status": "draft",
  "CreateDate": "2026-03-12T10:24:00Z",
  "CreateUser": {
    "ID": "7",
    "FullName": "John Smith"
  },
  "ModifyDate": "2026-03-12T10:24:00Z",
  "ModifyUser": {
    "ID": "7",
    "FullName": "John Smith"
  },
  "SystemStatusID": {
    "ID": "1",
    "Name": "Active"
  }
}

createBulk(slug, values [, options])

async · returns EntityCollection

Creates multiple records in a single operation. More efficient than calling create in a loop.

Prop

Type

const lineItems = [
  { InvoiceId: "101", Product: "Widget A", Qty: 3, Price: 19.99 },
  { InvoiceId: "101", Product: "Widget B", Qty: 1, Price: 49.99 },
  { InvoiceId: "101", Product: "Widget C", Qty: 5, Price: 9.99 },
];

const created = await context.functions.createBulk("lineitems", lineItems);
log("Created " + created.length + " line items");
Pro Tip

createBulk is significantly more efficient than looping over create. Use it whenever you need to insert more than one record at a time. Access results by index (created.records[0].ID) or iterate with created.records.forEach(...).

Returned value

An EntityCollection — an array of all newly created entities in the same order as the input, each with system fields:

"records": [
  {
    "Attributes": {
      "ID": "201",
      "InvoiceId": "101",
      "Product": "Widget A",
      "Qty": 3,
      "Price": 19.99,
      "CreateDate": "2026-03-12T10:25:00Z",
      "CreateUser": {
        "ID": "7",
        "FullName": "John Smith"
      },
      "ModifyDate": "2026-03-12T10:25:00Z",
      "ModifyUser": {
        "ID": "7",
        "FullName": "John Smith"
      },
      "SystemStatusID": {
        "ID": "1",
        "Name": "Active"
      }
    }
  },
  {
    "Attributes": {
      "ID": "202",
      "InvoiceId": "101",
      "Product": "Widget B",
      "Qty": 1,
      "Price": 49.99,
      "CreateDate": "2026-03-12T10:25:00Z",
      "CreateUser": {
        "ID": "7",
        "FullName": "John Smith"
      },
      "ModifyDate": "2026-03-12T10:25:00Z",
      "ModifyUser": {
        "ID": "7",
        "FullName": "John Smith"
      },
      "SystemStatusID": {
        "ID": "1",
        "Name": "Active"
      }
    }
  },
  {
    "Attributes": {
      "ID": "203",
      "InvoiceId": "101",
      "Product": "Widget C",
      "Qty": 5,
      "Price": 9.99,
      "CreateDate": "2026-03-12T10:25:00Z",
      "CreateUser": {
        "ID": "7",
        "FullName": "John Smith"
      },
      "ModifyDate": "2026-03-12T10:25:00Z",
      "ModifyUser": {
        "ID": "7",
        "FullName": "John Smith"
      },
      "SystemStatusID": {
        "ID": "1",
        "Name": "Active"
      }
    }
  }
]

Access individual records by index (created.records[0].ID) or iterate with created.records.forEach(...).