Change argument on each cronSchedule run

When running a workflow using setCronSchedule , can I pass different values into it each time it runs? For example, run1 completes an activity at timeX, and run2 needs to know the value of timeX.

If not, will that be achievable using the Scheduled Actions feature, which appears to be available in the typescript-SDK 1.20? Is there an expected release date for that feature in the java-sdk?

Regardless to the answers above, is this sample the recommended way to achieve my goal? samples-java/ at main · temporalio/samples-java · GitHub

If your cron execution returns a value you could get it out in the next cron run in workflow code via Workflow.getLastCompletionResult if you wanted.

Yes you could use periodic update and pass timeX as args to your continueAsNew stub as well.

It looks like getLastCompletionResult will work! Some follow ups:

  1. Has this functionality been implemented? Cancelling cron scheduled workflow gracefully
  2. Is there a recommended way to test a cronSchedule’d workflow?
  1. Not that I am aware of. Currently with cron you could send cancel request from client, handle it, and in detached cancellation scope run activity that terminates this execution to stop the cron (by workflow id). This part is definitely easier with schedules.
  2. There is a test in java samples repo here if that helps.
    For tests one thing to consider is to set WorkflowExecutionTimeout in workflow options, as that would trigger cron stop. Not recommended to set this for prod.

Thanks! And I just learned that if I run a workflow via the temporal schedule command, getLastCompletionResult works too!