Supista
Contact Us
documentation
Supista ERP
Samples
Scheduler

Schedulers

Schedulers enable you to automate actions at defined intervals using cron expressions. They're ideal for tasks such as automatic data updates, periodic notifications, and report generation.

Actions Supported by Schedulers

Modifying Database Data:

Automatically update records or perform periodic data transformations.

Sending Emails:

Dispatch notifications, reports, or alerts to designated recipients at scheduled intervals.


Important Behavior – No Direct Input

Schedulers do not receive runtime input parameters like normal API operations. Instead, when configuring a scheduler, you must explicitly perform a read operation on the target table within the scheduler logic itself. The code written inside the scheduler is executed against the data retrieved from the table at the scheduled time.

This means:

If you want the scheduler to process or modify records from a particular table, you must first call a readOp('tableName', ) (or equivalent) inside the scheduler code.

All actions are performed based on the data returned by this read operation.


How It Works

Setting the Schedule:

Users define the desired schedule using cron expressions to specify exact timing (e.g., daily, weekly, monthly).

Defining the Action:

The scheduler executes the predefined action—such as invoking an API operation, triggering a script, sending emails, or running database updates—when the scheduled time is reached. All processing is driven by the records fetched dynamically from the table through read operations.

Schedulers are a powerful mechanism for automating internal workflows and ensuring consistent, timely execution of critical system tasks without requiring any external input.


Example Code

async function customizeERP(userData, apiOperations) {
  const tableName = "tableName";
 
  const payload = {
    __d3__filterdata: {
      where: {
        // "columnName": "columnValue"
      }
    }
  };
 
  const resultRes = await readOp(tableName, payload);
  const resultData = resultRes?.count > 0 ? resultRes?.rows : [];
 
  if (resultData && resultData.length > 0) {
    const returnData = await Promise.all(
      userData.map(async (row) => {
 
        // your code goes here
 
        // write your code for that you want to run on the certain times
        // and set the scheduler time to run this code when you want
 
      })
    );
  }
}
Transform Data into Decisions with Supista – Your Intelligent Data Partner
AI-Powered Operational Intelligence for Growing Businesses

Automate your operations. Orchestrate your workflows. Scale with confidence.

Book a free strategy session with our Automation Experts and discover how Supista’s AI-Composable ERP can transform your operations into a scalable and intelligent system.