Create a One-Time CronAdmin Scope
You can configure the required cron as a JSON object and pass it to the createCron() SDK method to create your required cron. The following example snippet will detail how to create a One-Time Cron that will schedule the submission of a job to the job pool only once.
The jobScheduling reference used in the code snippets below is the component instance created to perform these operations.
Parameters Used
You need to construct two JSON objects, one that provides the meta of the job that needs to be submitted and the other is to contain your cron’s meta that will schedule the submission of the job to the job pool.
The JSON attributes used in these two JSONs are provided in the following table:
| JSON Object | JSON Attributes | Definition |
|---|---|---|
| job_meta | job_name | Mandatory parameter. Contains the name of the job that needs to be submitted to the job pool. |
| target_type | Mandatory parameter. Contains the type of the job. (Function | Circuit | Webhook | AppSail). | |
| target_name or target_id | Mandatory parameter. Contains the name or ID of the target type. While it is mandatory to provide value for either of them, it is optional to provide values for both fields. | |
| jobpool_name or jobpool_id | Mandatory parameter. Contains the name or ID of the Job Pool. While it is mandatory to provide value for either of them, it is optional to provide values for both fields. | |
| job_config |
|
|
| oneTimeCron | cron_name | Mandatory parameter. To refer to your cron. Ensure you provide a unique name. |
| description | Optional parameter. You can provide a description for your cron. | |
| cron_status | Mandatory parameter. Determines if the cron is enabled or not. Ensure it is set as 'true'. | |
| cron_type | Mandatory parameter. Determines the type of Cron. | |
| cron_detail | Mandatory parameter. Provide the schedule time in a UNIX timestamp format. | |
| job_meta | Mandatory parameter. Pass the jobMeta JSON object as value. |
// create function job meta
const jobMeta = {
job_name: 'test_job', // set a name for the job
target_type: 'Function', // set the target type as Function for function jobs
target_name: 'target_function', // set the target function's name (optional) (either target_id or target_name is mandatory)
// target_id: '123467890', // set the target function's ID (optional) (either target_id or target_name is mandatory)
jobpool_name: 'test', // set the name of the function jobpool (optional) (either jobpool_name or jobpool_id is mandatory)
// jobpool_id: '1234567890' // set the ID of the function jobpool (optional) (either jobpool_name or jobpool_id is mandatory)
job_config: {
number_of_retries: 2, // set the number of retries
retry_interval: 15 * 60 // set the retry interval
}, // set job config - job retries => 2 retries in 15 mins (optional)
params: {
arg1: 'test',
arg2: 'job'
} // set params to be passed to target function (optional)
};
// create one time cron details
const oneTimeCron = {
cron_name: 'one_time', // set a name for the cron (unique)
description: 'one_time_cron', // set a description for the cron (optional)
cron_status: true, // set the cron status as enabled
cron_type: 'OneTime', // set the cron type as OneTime
cron_detail: {
time_of_execution: Math.floor(Date.now() / 1000) + 60 * 60 + '' // set the execution time as UNIX timestamp
// timezone: 'America/Los_Angeles' // set the timezone (optional)
},
job_meta: jobMeta // set the function job meta
};
// create one time cron
const cronDetails = await jobScheduling.CRON.createCron(oneTimeCron);
Last Updated 2026-07-02 14:51:41 +0530 IST
Yes
No
Send your feedback to us