Documentation
  • Introduction
  • The Platform
    • Create Application
    • View Builder
    • Report Builder
    • UI Templates
    • Client Policies
    • Client Script
    • Properties
    • Scripting Console
    • Routes
    • Server Policies
    • Server Scrips
    • Scheduled Jobs
    • Data Aggregation
    • Fields
    • Field Dropdowns
    • Collections
    • Sample Application
    • Debugging
  • Reference
    • Introduction
    • API
    • Functions
    • Errors
  • SOFOS EDU-TECH
    • Introduction
    • Reports
    • API
  • PELATIS ITSM
    • Introduction
  • Apps
    • USER MANAGEMENT APP
    • Order Management
      • Client
        • OrderManagement
        • AllOrders
        • ProductManagement
          • ProductTable
          • ProductForm
      • Server Scripts
        • Order
        • Product
      • API
        • Orders
        • Products
Powered by GitBook
On this page

Was this helpful?

  1. The Platform

Scheduled Jobs

Scheduled Jobs are automated scripts that can perform a specific task at a specific time or on a recurring schedule. Eg - Sending notifications to users whose subscription has expired.

Fill the following details to create a schedule job :- Name - name of the schedule job Active - chech / uncheck to activate / deactivate the job. State - state shows whether the job is running or not. Job Type :- Interval - job will run every interval defined by the cron pattern. On Demand - job will run only with manual intervention whenever you want it to run. Schedule - provide cron pattern here like */1 * * * * which means job will run every minute.

Below is a sample code to delete stale logs and events generated by the platform.

const DB = ob.db.getConnection();
DB.collection('pltf_log').deleteMany({
  created_on: {
    $lte: new Date(
      ob.moment
        .tz('Asia/Kolkata')
        .subtract(15, 'days')
        .startOf('day')
        .toISOString()
    )
  }
});

DB.collection('pltf_event_queue').deleteMany({
  created_on: {
    $lte: new Date(
      ob.moment
        .tz('Asia/Kolkata')
        .subtract(15, 'days')
        .startOf('day')
        .toISOString()
    )
  }
});

DB.collection('pltf_transaction').deleteMany({
  created_on: {
    $lte: new Date(
      ob.moment
        .tz('Asia/Kolkata')
        .subtract(100, 'days')
        .startOf('day')
        .toISOString()
    )
  }
});

DB.collection('deleted').deleteMany({
  created_on: {
    $lte: new Date(
      ob.moment
        .tz('Asia/Kolkata')
        .subtract(90, 'days')
        .startOf('day')
        .toISOString()
    )
  }
});
PreviousServer ScripsNextData Aggregation

Last updated 1 year ago

Was this helpful?