cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Can we set Scheduler time/CRON dynamically from service TWX 9.1?

VaibhavShinde
16-Pearl

Can we set Scheduler time/CRON dynamically from service TWX 9.1?

Hi ,

 

Is it possible to change CRON in Scheduler dynamically? I have Column (DateTime) in Grid. based on This date need to set  CRON in Scheduler.

 

Thanks

6 REPLIES 6

The CRON String should be contained within a configuration table called Settings

So you can use GetConfigurationTable and SetConfigurationTable services to dynamically change it.

It probably requires a RestartThing after you change it.

Hi @PaiChung ,

In SetConfigurationTable. what will be Datashape for Configuration table input? 

 

Thanks

Use the Get service to investigate that, although usually there is a datashape matching the or kind of matching the configuration table name. Might be a system object.

Call Get Configuration Table service and update your cron and provide the same output as input to your set configuration table service.

Hi @VaibhavShinde.

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Hope this helps,

/** GET SETTINGS **/
var settings = Things["Scheduler_Scheduler"].GetConfigurationTable({
	tableName: "Settings" /* STRING */
});

/** UPDATE SETTINGS **/
settings.schedule = "0 0/9 * * * ?"; //Example
Things["Scheduler_Scheduler"].SetConfigurationTable({
	configurationTable: settings /* INFOTABLE */,
	persistent: true /* BOOLEAN {"defaultValue":true} */,
	tableName: "Settings" /* STRING */
});
Top Tags