I am building a process to pull all jobs that completed within the last 24 hours. However, I am getting some jobs back with an End Time more than 24 hours ago. Not sure what I’m doing wrong.
First I assign this - ReportTimeFrameDays is an argument, and is currently set to 1:
TimeFrame = Now.AddDays(-ReportTimeFrameDays)
Then, in the Get Jobs activity I filter like this:
I then ConvertFromUTC to Eastern Standard Time to get the correct start and end times for each row. In my output, nothing goes back further than the previous day, as I would expect, but I do get results for that day that ended more than 24 hours ago. I’m sure that I’m doing something wrong in the filter, but I’m not sure what it is.
Troubleshooting steps:
We have PowerShell scripts which we set our filter on. It is equivalent to your TimeFrame variable with a -4 hours in your case it is -ReportTimeFrameDays variable.
In PowerShell we set the variable as $timePast = (get-date).AddHours(-4).ToString("yyyy-MM-ddTHH\:mm\:ss.ffZ")
When I ran your TimeFrame variable and "EndTime gt "+TimeFrame.ToString("yyyy-MM-dd")+"T"+TimeFrame.ToString("hh:mm:ss")+"Z" in UiPath I get
So, I think there is a slight difference in the two strings. The one we use in our API calls gets us the logs from orchestrator so that must be the format the UiPath API requires.
The difference here is a ".ff", which is The hundredths of a second in a date and time value. before the Z 2021-07-28T07:38:08.89Z (PowerShell) vs. 2021-07-26T11:37:45Z (Your UiPath TimeFrame)
I am here assuming the Orcehstrator API does not understand the TimeFrame variable (requires .ffZ) of yours.
A workaround solution which should work for you:
Set a static hundredths of a second. Here I use “.01”