Skip to main content
anjup0143
Known Participant
October 27, 2021
Question

Calling Expression Rule inside Timer Event

  • October 27, 2021
  • 8 replies
  • 0 views

We have a requirement to build the scheduler process to run 3 days before every quarter. The  Logic has been built in the expression rule . When I am trying to call the rule in the timer to get the specific day to run, the process is not running whereas when I implicitly paste the logic, it works. Is there any limitations that expression rule can't be evaluated inside the timer.

8 replies

mikes0011
Brainy
October 27, 2021

I'm a little fuzzy on this, but I think you have to assume the value of the timer expression (whether based on an expression rule, or hardcoded) will be evaluated upon activation of the timer node (or upon publication of the process model for start process timers), and no changes to the value or output of the expression after that point will have any effect.

The Expression Guru
stewart.burchell
October 27, 2021

The way I've seen this typically implemented dis that your timer runs every night at a pre-determined time, and then an XOR routes the processing either to an end node (if it's not the right time to run - in your case 3 days before every quarter), else it triggers a separate process. It pays to separate the "controller" aspect (i.e. the timer and the routing) from the actual processing, so build them as separate process models and have the controller call the processor.

anjup0143
anjup0143Author
Known Participant
October 28, 2021

This is the way I have implemented to run the scheduler which runs every month and the specific day will be evaluated from the expression rule and also added additional condition to run every quarter. Could you please advise whether this is the feasible solution or Do I need to run every day and check in the XOR whether to run the process or not as suggested.

csteward
October 28, 2021

I believe this should work fine as the timer conditions are evaluated at run time.  This is where I typically include boolean constants for all of my scheduled processes so they can be turned on/off by changing the constant value. 

csteward
October 27, 2021

Yes, agree with both comments here.  You will also note this if you set a start timer for a process model based on a constant, then you change the constant later, the process model start time will not change until you re-publish the process model, at which time the timer re-evaluates against the new constant value.

We use Stewart's solution typically - have a parent process start an instance every day, run to an XOR node where your rule is evaluated to determine if it is the correct day.  If it is the 3rd day before the quarter, continue to the process.  If it is not, simply exit to an end node.  Have a short cleanup period on the processes and this should work fine for you.