Start timer event , time cycle as variable


I have a process with a start event as a timer event where i set a cron value :

    <bpmn:timeCycle xsi:type="bpmn:tFormalExpression">0 0 12 1/21 * ? *</bpmn:timeCycle>

I know that we can put a variable but my question is , as it is a start timer event , camunda will run this process automatically , where can i set the variable ? , suppose i set

    <bpmn:timeCycle xsi:type="bpmn:tFormalExpression">${cronExpression}</bpmn:timeCycle>

Where should i set this variable? Thanks.

IIRC the expression you supply is evaluated once, on deployment of the process definition. If you deploy a new version of the same process, it will be evaluated again.

It’s not really a variable you’re setting, as you would normal process variables, but it’s an expression to be executed. A standard way of implementing that in a Java environment for instance would be to go out to a bean (Spring or EE) and invoke some method that has a String return type and the value would be the applied to the timer definition at the time the process is deployed. This method is used for instance when you want the environment to determine the actual values, for instance by injecting some value into the bean I mentioned.