Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
dear all expert
let params = {
name: 'TestingScheduler9000' /* STRING */,
description: 'samplething' /* STRING */,
thingTemplateName:'Scheduler' /* THINGTEMPLATENAME */,
projectName:'MailserverGoogle' /* PROJECTNAME */,
runAsUser:'Hariharasuthan',
schedule:'0 0/9 * * * ?',
};
let result=params;
// no return
Resources["EntityServices"].CreateThing(params);
runAsUser:'Hariharasuthan', schedule:'0 0/9 * * * ?', both are not update ,how to update
Solved! Go to Solution.
hope it will be helpful.
/** CREATE AND ENABLE SCHEDULE THING **/
//create thing code
/** GET SETTINGS **/
var settings = Things["Scheduler_Scheduler"].GetConfigurationTable({
tableName: "Settings" /* STRING */
});
/** UPDATE SETTINGS **/
settings.runAsUser = "System";
settings.schedule = "0 0/9 * * * ?";
Things["Scheduler_Scheduler"].SetConfigurationTable({
configurationTable: settings /* INFOTABLE */,
persistent: true /* BOOLEAN {"defaultValue":true} */,
tableName: "Settings" /* STRING */
});
hope it will be helpful.
/** CREATE AND ENABLE SCHEDULE THING **/
//create thing code
/** GET SETTINGS **/
var settings = Things["Scheduler_Scheduler"].GetConfigurationTable({
tableName: "Settings" /* STRING */
});
/** UPDATE SETTINGS **/
settings.runAsUser = "System";
settings.schedule = "0 0/9 * * * ?";
Things["Scheduler_Scheduler"].SetConfigurationTable({
configurationTable: settings /* INFOTABLE */,
persistent: true /* BOOLEAN {"defaultValue":true} */,
tableName: "Settings" /* STRING */
});
let params = {
name:"TestingScheduler999" /* STRING */,
description: "samplething" /* STRING */,
thingTemplateName:"Scheduler" /* THINGTEMPLATENAME */,
projectName:"MailserverGoogle" /* PROJECTNAME */,
runAsUser:'Hariharasuthan',
schedule:'0 0/9 * * * ?',
};
Resources["EntityServices"].CreateThing(params);
Things["TestingScheduler999"].Enabled();
var settings = Things["TestingScheduler999"].GetConfigurationTable({
tableName: "Settings" /* STRING */
});
/** UPDATE SETTINGS **/
settings.runAsUser = "System";
settings.schedule = "0 0/9 * * * ?";
Things["TestingScheduler999"].SetConfigurationTable({
configurationTable:settings /* INFOTABLE */,
persistent: true /* BOOLEAN {"defaultValue":true} */,
tableName: "Settings" /* STRING */
});
return error:
1. Error executing service testthing. Message :: TypeError: Cannot call property Enabled in object com.thingworx.things.scheduler.SchedulerThing@4f6b8821. It is not a function, it is "boolean". - See Script Error Log for more details.
.create thing()
.enable thing()
. restart thing()
Then use previous code.