Sample Scripts
Logging
Use Logger instead of the console. Log messages will appear in the Debug Console under the Server Logs tab.
Logger.log(...);
Logger.info(...);
Logger.debug(...);
Logger.warn(...);
Logger.error(...);Debug Console must be open in order for the messages to appear.
Fetching Multiple Records from a DataSource
const records = await db.find("DataSourceName", {
filter: [
{ name: { sw: "Steve" } },
{ joinDate: { after: new Date().toISOString() } },
{ amount: { eq: 123 } },
],
limit: 20,
});Fetching a Single Record from a DataSource
Inserting a Record
Inserting Multiple Records
Number of calls to the above functions are limited to 100 from within a single execution of a Server Side Script or Cloud Function.
If you want to insert more than 100 rows in a single execution, always use db.insertMany(...) instead of multiple db.insertOne(...) calls.
Duplicating a Record
Throwing a Functional Error
Calling an external REST Service
Executing SQL Queries
Awaiting for all Promises to completion
Wrong Way ❌
Right Way ✅
Sending User Notification
Sending Email
Triggering Workflow
Process Mustache Template String
Format Date
Last updated
Was this helpful?