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(...);

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,
});

You can pass a different appUid as an option to fetch data from that app. See line no. 8 in the below example

Fetching a Single Record from a DataSource

Inserting a Record

You can pass a different appUid as an option to fetch data from that app. See line no. 4 in the below example

Inserting Multiple Records

Similarly use updateOne, updateMany, deleteOne, deleteMany to perform Update or Delete operations

Duplicating a Record

Throwing a Functional Error

Calling an external REST Service

Executing SQL Queries

You can pass true (boolean) as the 3rd parameter to query against the cloudio schema instead of your application schema

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?