Record methods and pagination
Every generated <Schema>Layout client is a DataApi instance configured with WebViewerAdapter. This page documents the public method signatures and options available on generated clients.
Response payload structure
list, get, and find operations resolve to a common response envelope:
{
data: [{ fieldData, recordId, modId, portalData }],
dataInfo: { foundCount, returnedCount, totalRecordCount, database, layout, table },
}
-
fieldData: Typed field values validated against generated schemas. -
recordIdandmodId: Returned as strings (methods accept strings or numbers for input). -
portalData: Object map of portal rows keyed by portal object name.
create returns { recordId, modId }; update returns { modId }; delete returns {}. listAll and findAll return flat record arrays without the dataInfo envelope.
Query methods
list
Returns records from a layout sequentially without find criteria:
const response = await ContactsLayout.list({
limit: 25,
offset: 1,
sort: { fieldName: "Name", sortOrder: "ascend" },
});
get
Retrieves a single record by its internal recordId (returns data as a single-element array):
const response = await ContactsLayout.get({ recordId: 42 });
const contact = response.data[0]?.fieldData;
find
Executes a FileMaker find query. Pass an object for single criteria, or an array of objects to combine criteria via logical OR:
// Find Active OR Pending records
await ContactsLayout.find({
query: [{ Status: "Active" }, { Status: "Pending" }],
sort: [{ fieldName: "Name", sortOrder: "ascend" }],
limit: 25,
});
Add omit: "true" within a query object to exclude matching records. Finds with no matches throw FileMaker error 401 unless ignoreEmptyResult: true is passed.
Single-record helpers
-
findFirst: Returns the first matching record as a single object. Throws if no records match. -
maybeFindFirst: Returns the first matching record, ornullif nothing matches. -
findOne: Returns the single matching record. Throws if zero records or more than one record matches.
const contact = await ContactsLayout.findFirst({ query: { Status: "Active" } });
const maybeArchived = await ContactsLayout.maybeFindFirst({ query: { Status: "Archived" } });
Pagination and unbounded queries
listAll and findAll automatically fetch and paginate all matching records across multiple requests, returning a single flat array:
const allActive = await ContactsLayout.findAll({ query: { Status: "Active" } });
Warning Memory considerations: listAll and findAll fetch all matching records into browser memory. On large datasets, use paginated find or list queries with explicit limit and offset parameters.
ignoreEmptyResult handling
By default, find queries returning zero records throw FileMaker error 401. Pass ignoreEmptyResult: true to return an empty array instead:
const response = await ContactsLayout.find({
query: { Status: "Archived" },
ignoreEmptyResult: true,
});
// response.data is [] when no matches exist
Mutation methods
create
const { recordId, modId } = await ContactsLayout.create({
fieldData: { Name: "Jane Doe", Status: "Active" },
});
update
await ContactsLayout.update({
recordId: 42,
modId: 3,
fieldData: { Status: "Inactive" },
});
Pass modId to enforce optimistic locking; FileMaker rejects updates if the record was modified by another session.
delete
await ContactsLayout.delete({ recordId: 42 });
layoutMetadata
Retrieves layout metadata (field definitions, value lists, and portals):
const meta = await ContactsLayout.layoutMetadata();
containerUpload
Uploads binary file assets directly to FileMaker container fields:
await ContactsLayout.containerUpload({
containerFieldName: "Photo",
file,
recordId: 42,
});
| Parameter | Type | Required | Description |
|---|---|---|---|
containerFieldName
|
string
|
Yes | Target container field name. |
file
|
Blob | File
|
Yes | Binary asset to upload (must have a file name and extension). |
recordId
|
string | number
|
Yes | Internal record ID. |
modId
|
number
|
No | Expected modification ID for optimistic concurrency checks. |
containerFieldRepetition
|
number
|
No | Field repetition (default is 1). |
timeout
|
number
|
No | Upload timeout in milliseconds. |
Warning Upload timeouts: If the upload script exceeds the timeout, ContainerUploadTimeoutError is thrown with an unknown outcome state. Verify the record before retrying.
Related topics
-
WebViewerAdapter—Bridge routing and request batching.
-
Script calls—Call FileMaker scripts using
fmFetch. -
Validation and transformation—Schema validation behavior.