0
votes

I'm trying to schedule a bot which is being triggered from orchestrator every 3 hours. The process is basically an email automation. If the no of emails that is being processed is less than average, i want to trigger the bot.

Is there a cron expression that can help me with this type of scheduling?

Do let me know if there any other way to achieve this (like making a change in code or some other method).

2
You should always post some code showing what you've tried and others will gladly help - kivul

2 Answers

1
votes

You'll need something to determine when the criteria are met to trigger a job to run. This could be done from another automated process; a monitor, which in turn would invoke your email process, or from an outside source if you have a monitoring platform or another external source.

When triggered, you'll want to make a few calls to the Orchestrator API to start an adhoc/manual job.

  1. Authenticate /api/Account/Authenticate (Assuming you are using local credentials and not Domain)
  2. Get Job Key /odata/Releases (If you already know the key for the given process, you could hardcode it in the next step instead of calling this one each time)
  3. Start Job /odata/Jobs/UiPath.Server.Configuration.OData.StartJobs

    Example request body:

    {
      "startInfo": {
        "ReleaseKey": "string",
        "Strategy": "All",
        "RobotIds": [
          0
        ],
        "NoOfRobots": 0,
        "JobsCount": 0,
        "Source": "Manual",
        "InputArguments": "string"
      }
    }
    
  4. Check Status of Job /odata/Jobs(jobid).

More information on the Orchestrator API can be found in The UiPath ORchestrator Guide. I'd also recommend checking out your swagger UI in Orchestrator, by adding /swagger onto the end of your Orchestrator URL. e.g. https://platform.uipath.com/swagger/

0
votes

To trigger your robot from studio you can use invoke power shell activity (https://activities.uipath.com/docs/invoke-power-shell) with -file / -f command to execute a workflow.

UiRobot -file "C:\UiPath\Project\Main.xaml"

For this you will have to navigate to the directory in which the Robot is installed.

You can find more information here: https://robot.uipath.com/docs/arguments-description.

OR

You can also make a HTTP request to the orchestrator API. You can find more information here: https://orchestrator.uipath.com/v2018.4/reference#jobs-requests