Randomized Scheduling in UiPath Orchestrator

Hi Folks, Hope you all doing good.

I want to schedule an unattended process in Orchestrator with a random time interval, rather than a fixed one. I want it to run between every 2 to 5 hours.

I know I can do it using a custom logic within the workflow, but that isn’t convenient that way the process will be 24 hours in running state in the unattended machine.

Hopefully there is way to implement this directly through Orchestrator’s scheduling feature aka Triggers. If yes, how do I do it? What triggers should I use? Does cron expression supports random time/interval?

Appreciate any insights or suggestions! Thanks in advance!


May I know what is the reason you need random time intervals?

There is no cron expression or a trigger to start the jobs between random intervals, but if you can explain your requirement we can share you if there is any other possibility other than using custom logic in your process


1 Like

There isn’t anything like this in Orchestrator scheduling.

If I had to do this, I would create an Excel file to create a random time. Then I would have the robot run every 10 mins for example and check if the time in the Excel file has passed. If so, send the email and create the next random time. If not, exit the process.

I was also thinking you could create a process to send an email to yourself with a random delay time, then trigger your actual process when that email is received. But I don’t see a way to send email with delay in UiPath.

1 Like

As others have said, there is no out of the box way to achieve this sort of scheduling in orchestrator.
An alternate I can recommend is to use multiple schedules with different intervals in between them.

1 Like

Hi @Tejaa

Use below Cron Expression to run the process after every 2 Hours.

0 0 */2 1/1 * ? *

Happy Automation :slight_smile:

1 Like

Hey @Tejaa,

Yes, there is a way to implement triggers directly through Orchestrator.

You can create two triggers for your process i.e one trigger will execute every 2 hours, and the other trigger will execute every 5 hours.

→ For the first trigger (2-hour interval), you can use the following cron expression: 0 0 */2 ? * .

→ For the second trigger (5-hour interval),you can use the following cron expression: 0 0 */5 ? * .

Happy Automation!!

1 Like

I can think of a few ways to apply some form of randomness in execution. None are out of the box, nor perfect.

In the end it’s all about starting the job at time x, where x is a randomized time after the previous run. Timed triggers, as mentioned in posts above, don’t support this, so ignore those.
So in order to achieve your result is triggering your jobs from another method. Could be an API service, or maybe having the bot reschedule it’s own next run using API and or orchestrator activities.

Alternatively, depending on the design of your process, you can use queue triggers, where you postpone a queueitem to a randomized future time. The queueitem might not even be process relevant, other than this job scheduling, so a separate scheduling queue might work best here. Once you 1st start your workflow, add a queueitem to your scheduler queue with random postpone time, then run the rest of your process.
Next step in execution is to get that due-item if available and complete it. This way you’ll always have a single open queueitem with a future due date/time which is started by your queuetrigger.

This solution will then run randomly, and complete when done, so no 24/7 runs, only when scheduled.

Randomizing the time itself should be easy, start the job or schedule the queueitem at now.addhours([some randomized integer])

1 Like

@Anil_G Thanks for replying. The purpose is Instead of running the bot every 2 hours, I want the interval between every run to be unique so that it looks more human.

@KevinE This looks interesting. Can you please share more details about this? How can I implement it easily? Thanks.

Thanks @Sharath_HK @Archana_Gulli! This I had in my mind, I will have to do it this way if I don’t find any other option. The problem is that still, the interval between every run in the longrun will somehow be unique because of less of options.

Thanks @Jeroen_van_Loon, But this will be very complex for me. :sweat_smile:


Try choosing a task automation tool or scheduler that supports random interval scheduling… some of the popular tools like Windows Task Scheduler, cron jobs on Unix-based systems might be useful…


Running every 1 hours and then you can check when is the last run by writing run time to asset and then use a random number and if number matches run else no

One more way would be at the end of process use api call to schedule the job for next run while scheduling everytime just generate a random number and pass it in parameters so that evrytime it tuns a random single run schedule is created


@Archana_Gulli @Anil_G

What if I use a random delay(in minutes) at the end of the workflow? Something like: random.Next(5, 21)

Along with 2 cron expressions that will schedule the process every 2 hours and every 5 hours.

This way the time gap will be unique right? And more straight forward?


You’re absolutely correct…

You can use the “Delay” or “Pause” activity to introduce the random delay.

It’s a straightforward way to achieve the desired randomness without creating multiple triggers.


Instead of end of process use it at start…so that actual start will differ because of the delay…

But again 2 and 5 might be constant…


1 Like

Note that you will consume the machine while you delay. So in case you’re tight on robot machine resources it would be better to solve it in a different way. @Jeroen_van_Loon’s post already contains good possible solutions. I’d probably go with creating a time trigger for the robot, and at the end of the run update the next run’s start time through Orchestrator api.

1 Like

Thanks, I will look it up.

I am using the community version with a personal VPS machine, is there any limitation? I thought we get 1 free unattended robot to run on community version but is there any limitation on how long I get to run this?

No limitation, other than you can only run one process at a time. So when this process consumes the license, you cannot run another one at the same time.

1 Like

Anil Bhai, I went through this again. Correct me If I got it correctly?

  1. I create a Cron trigger to run the process every 1 hour.
  2. At the beginning of each run, record the current run time and write it to an Orchestrator asset named “LastRunTime”
  3. Generate a Random Number at the beginning of the workflow.
  4. Use Random Number and Last Run Time for Matching, Run the Process if condition is met.

Is this what you meant? Then could you provide more details on how to use the random number and last run time to determine if the process should run or not because I am not clear about the 4th step?

Since that you’ve said this, I can think of something in a similar way, that is to schedule every 1 hour and generate a random number and check if the random number is even or odd and run if it’s even but here LastRunTime won’t be of any use.

Hi @Tejaa,

Others have helped you here with ideas to achieve what you want.

I would just like to add one more discussion point here; law of large numbers.

Even with implemented randomness, your trigger time will endup with a normal distribution in the long run. So if you want the automation to run between 2 to 5 hours, you might notice that with time, your automation usually will run around the 1.5 hours mark. In your case, the true mean is = (5-2)/2. It will take a few thousands of runs for you to notice this pattern, but eventually you will see this occuring.

Law of large numbers - Wikipedia

Shorter explanation of Law of Large Numbers (probabilitycourse.com)

So now knowing this, if I was doing this myself, I would weigh the efforts needed to implement the workaround to introduce this randomness vs. setting a static delay (around the true mean) between runs using the advanced trigger (cron) expression.

1 Like


So what you would do is get the last run time take the difference in hours for last run time and now…check if the hours is equal and not greater than 5…to the number generated…if yes then run else…just move on…if run then last runtime will change …else it would remain same and next random number between 2 and 5 will be genrated again and check continuous next time with same time…and if time diff is greater than or equals 5…then run…as you want it to be run at max 5 interval


Perfect! This is just perfect! I have implemented this. Now there is only one issue I can think of Or I think it’s a big miss from me from the start.

If the process runs, it takes 2-4 hours to complete.

So if the trigger runs every hour, especially when the process is already in a running stage, will it be an issue?

Or I somehow change the schedule time based on the time the process ends not from the time it starts to run.