2. Create Record
create(slug, values)
async· returns{ success, id, message }
Inserts a single record.
Prop
Type
const result = await context.functions.create("invoices", {
ClientName: "Acme Corp",
Amount: 1500.00,
Status: "draft"
});
log("Created invoice " + result.id);Returned value
{
"success": true,
"id": 84,
"message": "Record created successfully"
}create returns a small result object — not the saved row. The new primary key is on the lowercase id property (everywhere else the platform uses uppercase ID). If you need the full record, read it back with getById.
const result = await context.functions.create("invoices", { ClientName: "Acme Corp" });
if (!result.success) throw new Error("Could not create invoice: " + result.message);
const invoice = await context.functions.getById("invoices", result.id);
log(invoice.CreateDate);System fields are set for you
Do not pass ID, CreateDate, CreateUser, ModifyDate, ModifyUser, or SystemStatusID. They are stripped from the payload and populated by the platform. Fields with a default value defined in the schema are filled in automatically when you omit them.
Because a process has no signed-in user of its own, records it creates are attributed to the service account rather than to a person.
Creating many records
For more than one record, use createBulk rather than a loop — it is a single round trip and returns a per-record result. See Bulk Operations.
Failure handling
create does not throw when the insert is rejected by validation or permissions. It resolves with success: false and a reason in message. An unchecked create therefore fails silently:
const result = await context.functions.create("invoices", values);
if (!result.success) {
throw new Error("Invoice rejected: " + result.message);
}Throwing inside a BeforeCreate process aborts the write that started it. See Error Handling.