Skip to content

Commit aca1e93

Browse files
committed
docs: id syntax same as nocodb
Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
1 parent 43e4035 commit aca1e93

File tree

10 files changed

+71
-71
lines changed

10 files changed

+71
-71
lines changed

content/scripts/api-reference/base.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ In every script, you have access to a global `base` object that represents the c
1616

1717
## Properties
1818

19-
| Property | Type | Description |
20-
| -------- | ---- | ----------- |
21-
| `id` | `string` | The unique identifier of the base |
22-
| `name` | `string` | The name of the base |
23-
| `tables` | `Table[]` | Array of all tables in the base with their fields and views |
19+
| Property | Type | Description |
20+
|-----------------------|------------------|--------------------------------------------------------------------------------------|
21+
| `id` | `string` | The unique identifier of the base |
22+
| `name` | `string` | The name of the base |
23+
| `tables` | `Table[]` | Array of all tables in the base with their fields and views |
2424
| `activeCollaborators` | `Collaborator[]` | Array of active collaborators having access to this base (with read-only properties) |
2525

2626
## Methods
@@ -47,7 +47,7 @@ Both the table name and table ID are case-sensitive.
4747
const projects = base.getTable('Projects');
4848

4949
// Get a table by ID
50-
const tasks = base.getTable('tbl123456789');
50+
const tasks = base.getTable('m123456789');
5151

5252
// Check if a table exists
5353
const tableName = 'Customers';
@@ -222,7 +222,7 @@ if (teamMember) {
222222
}
223223

224224
// You can also search by ID or name
225-
const memberById = base.getCollaborator('usr_123456');
225+
const memberById = base.getCollaborator('u123456789'); // Replace with actual ID
226226
const memberByName = base.getCollaborator('John Doe');
227227

228228
// getCollaborator returns null if no match is found

content/scripts/api-reference/collaborator.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ This object enables user identification, tracking ownership, assigning responsib
1919

2020
## Properties
2121

22-
| Property | Type | Description |
23-
| -------- | ---- | ----------- |
24-
| `id` | `string` | The unique identifier of the collaborator (read-only) |
25-
| `name` | `string \| null` | The display name of the collaborator (read-only, may be null if not set) |
26-
| `email` | `string` | The email address of the collaborator (read-only) |
22+
| Property | Type | Description |
23+
|----------|------------------|--------------------------------------------------------------------------|
24+
| `id` | `string` | The unique identifier of the collaborator (read-only) |
25+
| `name` | `string \| null` | The display name of the collaborator (read-only, may be null if not set) |
26+
| `email` | `string` | The email address of the collaborator (read-only) |
2727

2828
**Note:** All Collaborator properties are read-only and cannot be modified.
2929

@@ -80,7 +80,7 @@ When a table has a User field type, `getCellValue()` returns a Collaborator obje
8080
```javascript
8181
// Get a record from the Tasks table
8282
const tasksTable = base.getTable('Tasks');
83-
const taskRecord = await tasksTable.selectRecordAsync('rec123456');
83+
const taskRecord = await tasksTable.selectRecordAsync('123');
8484

8585
// Get the assigned user (assuming 'Assigned To' is a User field)
8686
const assignedTo = taskRecord.getCellValue('Assigned To');
@@ -113,7 +113,7 @@ The `CreatedBy` and `LastModifiedBy` field types return Collaborator objects:
113113
```javascript
114114
// Get a record with system user fields
115115
const recordsTable = base.getTable('Documents');
116-
const document = await recordsTable.selectRecordAsync('rec123456');
116+
const document = await recordsTable.selectRecordAsync('123');
117117

118118
// Get the user who created the record
119119
const createdBy = document.getCellValue('Created By');

content/scripts/api-reference/cursor.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ This contextual awareness helps you create scripts that respond intelligently to
1919

2020
## Properties
2121

22-
| Property | Type | Description |
23-
| -------- | ---- | ----------- |
24-
| `activeBaseId` | `string` | The ID of the currently active base |
25-
| `activeTableId` | `string \| null` | The ID of the currently active table, or `null` if no table is active |
26-
| `activeViewId` | `string \| null` | The ID of the currently active view, or `null` if no view is active |
27-
| `row` | `Record < string, unknown > \| null` | The data of the currently selected row, or `null` if no row is selected |
22+
| Property | Type | Description |
23+
|-----------------|--------------------------------------|-------------------------------------------------------------------------|
24+
| `activeBaseId` | `string` | The ID of the currently active base |
25+
| `activeTableId` | `string \| null` | The ID of the currently active table, or `null` if no table is active |
26+
| `activeViewId` | `string \| null` | The ID of the currently active view, or `null` if no view is active |
27+
| `row` | `Record < string, unknown > \| null` | The data of the currently selected row, or `null` if no row is selected |
2828

2929
## Usage Examples
3030

content/scripts/api-reference/field.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ NocoDB supports a wide variety of field types to accommodate different kinds of
1919

2020
All Field objects share these common properties:
2121

22-
| Property | Type | Description |
23-
| -------- | ---- | ----------- |
24-
| `id` | `string` | The unique identifier of the field |
25-
| `name` | `string` | The display name of the field |
26-
| `type` | `UITypes` | The type of the field (e.g., SingleLineText, Number, Date) |
27-
| `description` | `string \| null` | The description of the field (if any) |
28-
| `isComputed` | `boolean` | Whether the field value is computed rather than directly editable |
29-
| `options` | `object \| null` | Type-specific options for the field |
22+
| Property | Type | Description |
23+
|---------------|------------------|-------------------------------------------------------------------|
24+
| `id` | `string` | The unique identifier of the field |
25+
| `name` | `string` | The display name of the field |
26+
| `type` | `UITypes` | The type of the field (e.g., SingleLineText, Number, Date) |
27+
| `description` | `string \| null` | The description of the field (if any) |
28+
| `isComputed` | `boolean` | Whether the field value is computed rather than directly editable |
29+
| `options` | `object \| null` | Type-specific options for the field |
3030

3131
## Common Methods
3232

@@ -633,7 +633,7 @@ const reviewers = record.getCellValue('Reviewers');
633633
const statusField = projectsTable.getField('Status');
634634

635635
// Get a field by ID
636-
const titleField = projectsTable.getField('fld123456');
636+
const titleField = projectsTable.getField('c123456');
637637

638638
// Check field properties
639639
if (statusField) {

content/scripts/api-reference/record-query-result.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ The RecordQueryResult object is designed to help you work efficiently with query
2020

2121
## Properties
2222

23-
| Property | Type | Description |
24-
| -------- | ---- | ----------- |
25-
| `records` | `ReadonlyArray<NocoDBRecord>` | Array of NocoDBRecord objects returned by the query |
26-
| `recordIds` | `ReadonlyArray<string>` | Array of record IDs (strings) returned by the query |
27-
| `hasMoreRecords` | `boolean` | Whether there are more records available beyond what was returned |
28-
| `table` | `Table` | Reference to the table from which records were queried |
29-
| `raw_data` | `Array` | The raw underlying data from the API response |
23+
| Property | Type | Description |
24+
|------------------|-------------------------------|-------------------------------------------------------------------|
25+
| `records` | `ReadonlyArray<NocoDBRecord>` | Array of NocoDBRecord objects returned by the query |
26+
| `recordIds` | `ReadonlyArray<string>` | Array of record IDs (strings) returned by the query |
27+
| `hasMoreRecords` | `boolean` | Whether there are more records available beyond what was returned |
28+
| `table` | `Table` | Reference to the table from which records were queried |
29+
| `raw_data` | `Array` | The raw underlying data from the API response |
3030

3131
## Methods
3232

content/scripts/api-reference/record.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Working with NocoDBRecord objects is central to most NocoDB scripts, as they all
1919

2020
## Properties
2121

22-
| Property | Type | Description |
23-
| -------- | ---- | ----------- |
24-
| `id` | `string` | The unique identifier for this record |
25-
| `name` | `string` | The primary display value for this record (derived from display field) |
22+
| Property | Type | Description |
23+
|----------|----------|------------------------------------------------------------------------|
24+
| `id` | `string` | The unique identifier for this record |
25+
| `name` | `string` | The primary display value for this record (derived from display field) |
2626

2727
## Methods
2828

@@ -43,7 +43,7 @@ Retrieves the value of a specific cell in the record.
4343
const projectsTable = base.getTable('Projects');
4444

4545
// Query a specific record
46-
const projectRecord = await projectsTable.selectRecordAsync('rec123456');
46+
const projectRecord = await projectsTable.selectRecordAsync('123');
4747

4848
if (projectRecord) {
4949
// Get cell values using field names
@@ -86,7 +86,7 @@ Gets a cell value formatted as a string, applying appropriate formatting based o
8686
const invoicesTable = base.getTable('Invoices');
8787

8888
// Query a specific record
89-
const invoiceRecord = await invoicesTable.selectRecordAsync('rec123456');
89+
const invoiceRecord = await invoicesTable.selectRecordAsync('123');
9090

9191
if (invoiceRecord) {
9292
// Get formatted string values
@@ -279,7 +279,7 @@ const taskCount = record.getCellValue('Task Count'); // number or null
279279
const tasksTable = base.getTable('Tasks');
280280

281281
// Get a specific record
282-
const taskRecord = await tasksTable.selectRecordAsync('rec123456', {
282+
const taskRecord = await tasksTable.selectRecordAsync('123', {
283283
fields: ['Task Name', 'Description', 'Status', 'Due Date', 'Assigned To', 'Priority']
284284
});
285285

@@ -319,8 +319,8 @@ if (taskRecord) {
319319
const employeesTable = base.getTable('Employees');
320320

321321
// Get two employee records
322-
const employee1 = await employeesTable.selectRecordAsync('rec123456');
323-
const employee2 = await employeesTable.selectRecordAsync('rec789012');
322+
const employee1 = await employeesTable.selectRecordAsync('123');
323+
const employee2 = await employeesTable.selectRecordAsync('456');
324324

325325
if (employee1 && employee2) {
326326
// Compare salary values

content/scripts/api-reference/script-settings.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ output.text(`Processing limit: ${limit}`);
5959

6060
The `input.config()` method accepts a configuration object with the following properties:
6161

62-
| Property | Type | Description |
63-
| -------- | ---- | ----------- |
64-
| `title` | `string` | Title of the script, displayed at the top of the settings form |
65-
| `description` | `string` | Description of what the script does (supports some markdown) |
66-
| `items` | `Array<ConfigItem>` | Array of configuration items for the settings form |
62+
| Property | Type | Description |
63+
|---------------|---------------------|----------------------------------------------------------------|
64+
| `title` | `string` | Title of the script, displayed at the top of the settings form |
65+
| `description` | `string` | Description of what the script does (supports some markdown) |
66+
| `items` | `Array<ConfigItem>` | Array of configuration items for the settings form |
6767

6868
### Configuration Item Types
6969

content/scripts/api-reference/session.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ The `session` object is available in every NocoDB script and provides a way to:
1414

1515
## Properties
1616

17-
| Property | Type | Description |
18-
| -------- | ---- | ----------- |
17+
| Property | Type | Description |
18+
|---------------|----------------|------------------------------------------------------------------------------------|
1919
| `currentUser` | `Collaborator` | A Collaborator object representing the current user running the script (read-only) |
2020

2121
## Usage Examples

content/scripts/api-reference/table.mdx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ Table objects are typically accessed through the `base` object and provide the p
1717

1818
## Properties
1919

20-
| Property | Type | Description |
21-
| -------- | ---- | ----------- |
22-
| `id` | `string` | The unique identifier of the table |
23-
| `name` | `string` | The name of the table |
24-
| `description` | `string \| null` | The description of the table (if any) |
25-
| `fields` | `Field[]` | Array of user-defined fields in the table (excludes system fields) |
26-
| `views` | `View[]` | Array of all views defined for the table |
27-
| `base` | `Base` | Reference to the parent base that this table belongs to |
20+
| Property | Type | Description |
21+
|---------------|------------------|--------------------------------------------------------------------|
22+
| `id` | `string` | The unique identifier of the table |
23+
| `name` | `string` | The name of the table |
24+
| `description` | `string \| null` | The description of the table (if any) |
25+
| `fields` | `Field[]` | Array of user-defined fields in the table (excludes system fields) |
26+
| `views` | `View[]` | Array of all views defined for the table |
27+
| `base` | `Base` | Reference to the parent base that this table belongs to |
2828

2929
## Methods
3030

@@ -47,7 +47,7 @@ Retrieves a field from the table by its ID or name. This method searches both us
4747
const titleField = projectsTable.getField('Title');
4848

4949
// Get a field by ID
50-
const statusField = projectsTable.getField('fld12345');
50+
const statusField = projectsTable.getField('c12345');
5151

5252
// Check if a field exists
5353
if (titleField) {
@@ -142,7 +142,7 @@ Retrieves a single record from the table by its ID.
142142
**Example:**
143143
```javascript
144144
// Get a specific record by ID
145-
const recordId = 'rec12345';
145+
const recordId = '123';
146146
const record = await contactsTable.selectRecordAsync(recordId, {
147147
fields: ['Name', 'Email', 'Phone']
148148
});
@@ -179,8 +179,8 @@ output.text(`New record created with ID: ${newRecordId}`);
179179

180180
// Create a record with field IDs
181181
const newRecordId2 = await contactsTable.createRecordAsync({
182-
'fld123': 'Jane Smith', // Name field
183-
'fld456': 'jane@example.com' // Email field
182+
'c123456': 'Jane Smith', // Name field
183+
'c456789': 'jane@example.com' // Email field
184184
});
185185
```
186186

@@ -230,13 +230,13 @@ Updates a record with the specified field values.
230230
**Example:**
231231
```javascript
232232
// Update a record by ID
233-
await contactsTable.updateRecordAsync('rec12345', {
233+
await contactsTable.updateRecordAsync('123', {
234234
'Status': 'Inactive',
235235
'Last Contact Date': new Date().toISOString()
236236
});
237237

238238
// Update a record using a Record object
239-
const record = await contactsTable.selectRecordAsync('rec12345');
239+
const record = await contactsTable.selectRecordAsync('123');
240240
if (record) {
241241
await contactsTable.updateRecordAsync(record, {
242242
'Notes': 'Customer requested follow-up next quarter.'
@@ -259,7 +259,7 @@ Updates multiple records with the specified field values.
259259
// Update multiple records at once
260260
await contactsTable.updateRecordsAsync([
261261
{
262-
id: 'rec12345',
262+
id: '123',
263263
fields: {
264264
'Status': 'Active',
265265
'Last Contact Date': new Date().toISOString()
@@ -289,11 +289,11 @@ Deletes a record from the table.
289289
**Example:**
290290
```javascript
291291
// Delete a record by ID
292-
await tasksTable.deleteRecordAsync('rec12345');
292+
await tasksTable.deleteRecordAsync('123');
293293
output.text('Record deleted successfully.');
294294

295295
// Delete a record using a Record object
296-
const record = await tasksTable.selectRecordAsync('rec67890');
296+
const record = await tasksTable.selectRecordAsync('678');
297297
if (record) {
298298
await tasksTable.deleteRecordAsync(record);
299299
output.text(`Record "${record.name}" deleted successfully.`);
@@ -312,7 +312,7 @@ Deletes multiple records from the table.
312312
**Example:**
313313
```javascript
314314
// Delete multiple records by ID
315-
await tasksTable.deleteRecordsAsync(['rec12345', 'rec67890', 'rec24680']);
315+
await tasksTable.deleteRecordsAsync(['123', '678', '246']);
316316
output.text('Records deleted successfully.');
317317

318318
// Delete records using a query result

content/scripts/api-reference/view.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Retrieves a single record from the view by its ID, applying the view's filters a
9393
const tasksTable = base.getTable('Tasks');
9494
const myTasksView = tasksTable.getView('My Tasks');
9595

96-
const recordId = 'rec12345';
96+
const recordId = '123';
9797
const task = await myTasksView.selectRecordAsync(recordId, {
9898
fields: ['Task Name', 'Status', 'Due Date', 'Notes']
9999
});

0 commit comments

Comments
 (0)