Skip to content

Commit 198fb0e

Browse files
authored
Merge pull request #262 from nocodb/docs/button-scripts
Docs/button scripts
2 parents 79aeb09 + cc04e88 commit 198fb0e

File tree

1 file changed

+27
-0
lines changed
  • content/docs/fields/field-types/custom-types

1 file changed

+27
-0
lines changed

content/docs/fields/field-types/custom-types/button.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,31 @@ Created webhook can be accessed by using the [Webhook](/docs/product-docs/automa
5454
<Callout type="note">Deleting a webhook will remove it from all Button fields that reference it, whereas deleting a Button field will not affect the associated webhook. A single webhook can also be reused across multiple Button fields.</Callout>
5555

5656
### Button Script
57+
5758
![image](/img/v2/fields/types/button/run-script.png)
59+
60+
Also termed as "Row Actions", Button Scripts let you trigger pre-configured actions directly from a record in Grid / Kanban / Gallery views. Instead of manually editing fields to update values like status or stage, you can now perform repetitive updates in a single click.
61+
62+
Each button is configured to execute a Frontend Script that updates the record or performs other automated actions. When a user clicks the button, the configured script runs in the context of that record.
63+
64+
Sample Script to update a field value:
65+
```javascript
66+
const recordID = cursor?.row?.id;
67+
const table = await base.getTable("Table-1");
68+
69+
if(recordID) {
70+
// Perform operations if recordID is valid
71+
console.log(`Record ID is: ${recordID}`);
72+
73+
// You can add more logic here based on your requirements
74+
await table.updateRecordAsync(recordID, {
75+
"Status": "Completed",
76+
"Title": "Default Title"
77+
})
78+
} else {
79+
// Handle the case where recordID is undefined or null
80+
console.error('Record ID is not defined');
81+
}
82+
```
83+
84+

0 commit comments

Comments
 (0)