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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

multiple DynamicSchedulerThing, but through single services .how to implement on multiple scheduler

Hariharasuthan
13-Aquamarine

multiple DynamicSchedulerThing, but through single services .how to implement on multiple scheduler

dear expert 

I created multiple DynamicSchedulerThing, but through single services. How to implement on multiple dynamic schedulers? i need java script code for above 

 

ACCEPTED SOLUTION

Accepted Solutions

Hi @Hariharasuthan 

 

Please follow the below steps :

 

Step 1: Create a new Scheduler ThingTemplate say 'MyCustomScheduler' from the default Scheduler Template

Step 2: Create a Subscription in ThingTemplate which you created in Step 1 

Step 3: Subscription Event should be SchedulerEvent and put your custom email code from Project YYYY

Step 4: Now create a new scheduler Thing say 'scheduler 1' from Template 'MyCustomScheduler'

 

So whenever an event is triggered it will execute the code from Project YYYY

 

/VR

View solution in original post

10 REPLIES 10

Could you explain the scenario with more detail? I cannot follow what you did or try to do, sorry.

step1:

scheduler 1 (weekly report) user 1

scheduler 2 (daily report) user 2

scheduler 3 (one hour report) user 3

scheduler 4 (monthly report) upto scheduler  N  (CRON ) values 

i have  multiple  scheduler created in project xxxx

 

step2:

i have my own service (email sent ) created in project yyy

 

step 3:

 

 integrated to the step1 and step2 , regarding.

multiple scheduler user applying through via the email service. this type need code how to config please share me

 

thanks And Regards 

Hariharasuthan

 

 

 

Hi @Hariharasuthan 

 

Could you please elaborate on your case with some example

 

/VR

step1:

scheduler 1 (weekly report) user 1

scheduler 2 (daily report) user 2

scheduler 3 (one hour report) user 3

scheduler 4 (monthly report) upto scheduler  N  (CRON ) values 

i have  multiple  scheduler created in project xxxx

 

step2:

i have my own service (email sent ) created in project yyy

 

step 3:

 

 integrated to the step1 and step2 , regarding.

multiple scheduler user applying through via the email service. this type need code how to config please share me

 

thanks And Regards 

Hariharasuthan

 

 

 

 

 

Hi @Hariharasuthan 

 

Please follow the below steps :

 

Step 1: Create a new Scheduler ThingTemplate say 'MyCustomScheduler' from the default Scheduler Template

Step 2: Create a Subscription in ThingTemplate which you created in Step 1 

Step 3: Subscription Event should be SchedulerEvent and put your custom email code from Project YYYY

Step 4: Now create a new scheduler Thing say 'scheduler 1' from Template 'MyCustomScheduler'

 

So whenever an event is triggered it will execute the code from Project YYYY

 

/VR

hi @Velkumar 

your share steps follow and implement but some problem and some doubt came here 

1.Error(

 
Output
 Thing [Scheduler_Dynamic_CRON139l] is not enabled)

Hariharasuthan_1-1682328599765.png

2.doubt 

MyCustomScheduler

Hariharasuthan_2-1682328891426.png

in this thing template and also some cron value but new scheduler 1 thing in this different cron value how is it, 

 

 

 

Hi @Hariharasuthan 

 

1. Is Scheduler_Dynamic_CRON139l created through service? if so enable it through service after the creation.

2. You don't need to worry about CRON String in Thing Template. The event will be triggered based on individual Thing CRON string

 

/VR

 

 

Hi @Velkumar 

  previously shared information very useful thanks, multiple DynamicSchedulerThing, but through dynamic  services .how to implement on multiple scheduler

 

step1:

scheduler 1 (weekly report) user 1

scheduler 2 (daily report) user 2

scheduler 3 (one hour report) user 3

scheduler 4 (monthly report) upto scheduler  N  (CRON ) values 

i have  multiple  scheduler created in project xxxx

 

step2:

i have my own service (email sent ) but dynamic  created in project yyy

emailServices1 (To address different from address different subject different)

emailServices2(To address different from address different subject different)

emailServices3(To address different from address different subject different)

 

emailServices N (To address different from address different subject different)

 

step 3:

 

 integrated to the step1 and step2 , regarding.

multiple scheduler user applying through via the email service. this type need code how to config please share me

 

scheduler 1 (weekly report) user 1 --->emailServices1 (To address different from address different subject different)

scheduler 2 (daily report) user 2--->emailServices2 (To address different from address different subject different)

scheduler N (monthly report) up to scheduler  N  (CRON ) values  --->emailServicesN (To address different from address different subject different)

this code requirement  steps need to be please help me .

 

step 4:

 

var params = {
name:"Scheduler_Dynamic_CRON139ol" /* STRING */,
description: "DEMO Scheduler With CRON dynamically set" /* STRING */,
thingTemplateName:"MyCustomScheduler" /* THINGTEMPLATENAME */,
projectName:"MailserverGoogle" /* PROJECTNAME */,
runAsUser:"Hariharasuthan",
schedule:"0 0/1 * * * ?"
};


result = 'thing doesnt exist';
let thingName = params.name;
if (Things[thingName])
{
//Things[thingName].Enable();
result = 'thing exist';
Things[thingName].EnableThing();
Things[thingName].RestartThing();
logger.warn("thing exist "+thingName);
}
else
{
result="new one";
Resources["EntityServices"].CreateThing(params);
logger.warn("Thing Created: "+thingName);
Things[thingName].EnableThing();
Things[thingName].RestartThing();
}
var settings = Things[thingName].GetConfigurationTable({
tableName: "Settings" /* STRING */
});

/** UPDATE SETTINGS **/
settings.runAsUser = params.runAsUser;
//settings.schedule = "0 0/5 * * * ?";
settings.schedule=params.schedule;
Things[thingName].SetConfigurationTable({
configurationTable: settings /* INFOTABLE */,
persistent: true /* BOOLEAN {"defaultValue":true} */,
tableName: "Settings" /* STRING */

});
//Things[thingName].Enabled();
logger.warn("Thing Setting Update "+thingName);
// Things[thingName].Enabled();

 

 

THIS CODE CREATED  dynamic thingscheduler BUT  SERVICES  how add through SAME  ? thingscheduler in Dynamic process ?

 

thanks And Regards 

Hariharasuthan

So how from & to email address varies? Do you have any criteria based on that you will be selecting from & to address ?

i have Cerita from thingworx services , i declare to email address .

E-mail services (to ,from, address  this value from database  sql server )

 

for example                         e-mail services 

scheduler 1                     service1 -- to: hari@gmail.com   from :vel@gmail.com 

scheduler 2                   service2 -- to: ram@gmail   from : kumar@gmail.com 

scheduler 3                     service3-- to: mmm@gmail.com   from : nnn@gmail.com 

scheduler 4                 service4 -- to: sss@gmail   from : sss@gmail.com 

 

for this code email services in this filed was  various 

Things["Mailserver_google"].SendMessageWithAttachment({
cc: "hari@gmail.com" /* STRING */,
path: "52.xlsx" /* STRING */,
bcc: undefined /* STRING */,
subject: "me test Report one mintues " /* STRING */,
fileRepository:"SystemRepository" /* THINGNAME */,
attachmentName:"52.xlsx" /* STRING */,
from: "test27@gmail.com" /* STRING */,
mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /* STRING */,
to: "testthingsworx@gmail.com" /* STRING */,
body: "Report At"/* HTML */

Announcements


Top Tags