Skip to content


$.jobs represents an XS scheduled job.


Sample usage:

Create a definition.xsjob file in a project named xsjob_demo:

    "description": "My Job configuration",
        "action": "xsjob_demo:handler.xsjslib::writeInDB",
        "schedules": [
            "description": "Execute every 5 seconds",
            "xscron": "* * * * * * */5",
            "parameter": {

Create a handler.xsjslib file in the xsjob_demo project:

function writeInDB() {
    let connection;
    try {
        connection = $.db.getConnection();

        let insertStatement = connection.prepareStatement("INSERT INTO XSJOB_DEMO (EXECUTED_AT) VALUES (CURRENT_TIMESTAMP)");
    } catch(e) {
        console.log("Transaction was rolled back: " + e.message);
    } finally {

And now, to use the API, create a trigger.xsjs file:

let job = new $.jobs.Job({
    uri: "xsjob_demo/definition.xsjob"

// execute the job for 60 seconds, starting from now
    status: true,
    start_time: new Date(),
    end_time: new Date( + 60000)


Function Description Returns
activate() Activates an XS Job that has already been configured. -
configure(config) Configure an XS Job. The function provides additional means to programmatically configure an XS Job. Configuration must be done prior to activate/deactivate an XS Job. -
deactivate() Deactivates an XS Job that has already been configured. -
getConfiguration() Retrieve current configuration of an XS Job as object. Object