64
Views
5
Comments
Solved
Is there a way to activate and deactivate timers programatically
Question

I tried to deactivate the timer using ossys_Cyclic_Job_Shared table attribute next run but its showing error as ossys is reserved prefix . any other way is there pls share. without using service center  i want to activate and deactivate in runtime in portal

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Aslam,

You do not need to use a SQL query, and use OSSYS. The System module has a Cyclic_Job_Shared entity you can use in an Aggregate, as well as entity actions to modify it:

As for activating/deactivating the timer, see my article on Timers. It describes the value to put in Next_Run (viz. #3000-01-01#) to deactivate the timer, and what to be aware of when doing so.

2023-11-23 17-00-57
Aslam.

Thanks 

2023-12-16 19-57-03
Sanjay Kushwah
Solution

Hi @Aslam.

You can simply create a site property isTimerActivate (boolean) and check in your timer's action on top of code if isTimerActivate = true then only code will execute else (false branch of If) End the code.

Wherever/whenever you want you can change the value of isTimerActivate site property 

This way you can mimic timer as deativated timer.

Thanks,

Sanjay Kushwah 

2024-07-18 10-54-11
Abhishek Hayaran

Hello Aslam,

To toggle the timer during runtime, you can manage it with a site property:

1. Establish a basic site property named IsRunTimer of type Boolean, and default it to True.

2. Within the Timer's Logic, verify the IsRunTimer property. If it's true, proceed with the timer's execution; if not, terminate the logic early without any action.

3. Anytime you need to halt the timer within your Application, change the IsRunTimer site property to False. This will prevent the timer from running.

Hope this will help you, happy coding... 


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

This doesn't prevent the Timer from running, it only prevents the Timer from doing anything when it runs. Which may be what you want, but it needs a code change, and it's different from actually deactivating the Timer.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Aslam,

You do not need to use a SQL query, and use OSSYS. The System module has a Cyclic_Job_Shared entity you can use in an Aggregate, as well as entity actions to modify it:

As for activating/deactivating the timer, see my article on Timers. It describes the value to put in Next_Run (viz. #3000-01-01#) to deactivate the timer, and what to be aware of when doing so.

2023-11-23 17-00-57
Aslam.

Thanks 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.