Skip to main content
16-Pearl
August 1, 2023
Question

How to programmatically create a scheduler

  • August 1, 2023
  • 1 reply
  • 2854 views

Is it possible to programmatically create a Scheduler in thingworx 8.5.3?  I saw the following article, but I don't see this template in 8.5.3.

 

https://www.ptc.com/en/support/article/cs382629

 

I'd like to create a mashup where users can schedule email reminders for preventive maintenance.  The emails will be sent out to the users on the scheduled date/time.  In order to implement this, I think I need to be able to create a scheduler programmatically, where the subscription on the scheduler would be created automatically as well.

1 reply

19-Tanzanite
August 2, 2023

Hi @Willie 

 

'Scheduler' ThingTemplate is part of Thingworx. It cannot be deleted or removed from Thingworx. It should be available in Thingworx 8.5.3

 

Try to search/find the template using the Administrator account. If you cannot find it please create a PTC support ticket.

 

For your use case: 

 

  1. Create Scheduler ThingTemplate say 'emailSchedulerTemplate' with a subscription to trigger email.
  2. On Mashup when the user configures a reminder, create a new Thing based on 'emailSchedulerTemplate' and update its CRON string based on user input 

 

/VR 

Willie16-PearlAuthor
16-Pearl
August 3, 2023

Hi @Velkumar 

 

I was able to locate the 'Scheduler' thingTemplate and create a scheduler with the steps provided.  Thank you.

 

When the subscription is triggered, the email is sent out and the scheduler is supposed to delete itself.  I have the following line at the end of the subscription, but the scheduler doesn't delete itself.  Do I need to get another thing to delete the scheduler?

 

Resources["EntityServices"].DeleteThing(me.name);

 

19-Tanzanite
August 3, 2023

Hi @Willie 

 

Above mentioned code should work. Do you see any error when you execute the service manually?

 

/VR