cancel
Showing results for 
Search instead for 
Did you mean: 

Session's last update time from Runetime Resource command

TomaszSukiennik
Level 5
Hi,

Is there a way to get session's last update time (and maybe last stage) from some Runetime Resource command? Unfortunately I did not find anything like that. I'm not interest to take it directly from database due to lack of direct access.

Best regards

------------------------------
Tomasz Sukiennik
RPA Developer
Digital Teammates
Europe/Lodz
------------------------------
1 BEST ANSWER

Best Answers

DaveMorris
Level 14
As far as I know, there's no command to do exactly what you're asking for, but there's a close enough workaround that should be good enough for you.

Depending on the version of Blue Prism you're using, you may or may not have all the below commands, especially /resourcestatus, which I believe was added sometime between 6.6 and 6.8 or so. But the other commands should work. The problem is that without the /resourcestatus command, you may have a hard time getting the sessionid. So, just a quick suggestion there, you could have the Blue Prism process output its own sessionid somewhere after retrieving it with GetSessionId() in a calc stage.

Anyway, assuming you're on a newer version of Blue Prism, try commands like these (i'll give a couple examples with different parameters).

First this to get the list of sessions:
  • AutomateC /resourcestatus All /user Daffy DaffysPassword
  • AutomateC /resourcestatus PC001 10 m /sso
That will output Resource Name, Session ID, Status, Start Time, and End Time for every session within the time frame. 
Then using one of those session IDs, use one of these commands:
  • AutomateC /getlog a9b04a03-74cf-43a3-8a01-b95177f517f3 /user Daffy DaffysPassword
  • AutomateC /getlog a9b04a03-74cf-43a3-8a01-b95177f517f3 /sso
That will output the session log which includes the names of stages. You could then just get the last line from the log to use as your 'latest stage' kind of thing. Note that I do not think that the last line in that log necessarily will equal the latest stage. I think the Latest Stage shown in Control Room is actually the latest stage at the time it was last refreshed, whereas the log you retrieve is the session log, which is limited by stage logging settings. If all logging is turned off, then I assume you'd receive nothing back in that /getlog command.

Here's an example output I get from a random session I ran a while back. I used the /getlog command just now and got this as an output:
2018-07-14 15:03:46,00000000-0000-0000-0000-000000000000,,Created session log
2018-07-14 15:03:46,14164c13-322b-4bff-a343-c402d3a1f91f,Start,
2018-07-14 15:03:46,99716e31-6732-4388-9329-8367d3f6ba82,Launch Facebook,
2018-07-14 15:03:50,b250dcdc-2c31-476b-939c-ee6f933f852e,Navigate to About,
2018-07-14 15:03:54,2732a0fc-d899-4a19-8dfb-fc9807f6141d,Get Mission Value,
2018-07-14 15:03:54,50158602-9382-44a3-a8fc-fc48ec296acd,Close IE,
2018-07-14 15:03:55,34232fb3-d8e2-4527-8ca0-3f7f27c8723b,Mission Value Changed?,False
2018-07-14 15:03:55,2d50385f-4035-47f6-a8e4-66427c9dc980,End,

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

View answer in original post

2 REPLIES 2

DaveMorris
Level 14
As far as I know, there's no command to do exactly what you're asking for, but there's a close enough workaround that should be good enough for you.

Depending on the version of Blue Prism you're using, you may or may not have all the below commands, especially /resourcestatus, which I believe was added sometime between 6.6 and 6.8 or so. But the other commands should work. The problem is that without the /resourcestatus command, you may have a hard time getting the sessionid. So, just a quick suggestion there, you could have the Blue Prism process output its own sessionid somewhere after retrieving it with GetSessionId() in a calc stage.

Anyway, assuming you're on a newer version of Blue Prism, try commands like these (i'll give a couple examples with different parameters).

First this to get the list of sessions:
  • AutomateC /resourcestatus All /user Daffy DaffysPassword
  • AutomateC /resourcestatus PC001 10 m /sso
That will output Resource Name, Session ID, Status, Start Time, and End Time for every session within the time frame. 
Then using one of those session IDs, use one of these commands:
  • AutomateC /getlog a9b04a03-74cf-43a3-8a01-b95177f517f3 /user Daffy DaffysPassword
  • AutomateC /getlog a9b04a03-74cf-43a3-8a01-b95177f517f3 /sso
That will output the session log which includes the names of stages. You could then just get the last line from the log to use as your 'latest stage' kind of thing. Note that I do not think that the last line in that log necessarily will equal the latest stage. I think the Latest Stage shown in Control Room is actually the latest stage at the time it was last refreshed, whereas the log you retrieve is the session log, which is limited by stage logging settings. If all logging is turned off, then I assume you'd receive nothing back in that /getlog command.

Here's an example output I get from a random session I ran a while back. I used the /getlog command just now and got this as an output:
2018-07-14 15:03:46,00000000-0000-0000-0000-000000000000,,Created session log
2018-07-14 15:03:46,14164c13-322b-4bff-a343-c402d3a1f91f,Start,
2018-07-14 15:03:46,99716e31-6732-4388-9329-8367d3f6ba82,Launch Facebook,
2018-07-14 15:03:50,b250dcdc-2c31-476b-939c-ee6f933f852e,Navigate to About,
2018-07-14 15:03:54,2732a0fc-d899-4a19-8dfb-fc9807f6141d,Get Mission Value,
2018-07-14 15:03:54,50158602-9382-44a3-a8fc-fc48ec296acd,Close IE,
2018-07-14 15:03:55,34232fb3-d8e2-4527-8ca0-3f7f27c8723b,Mission Value Changed?,False
2018-07-14 15:03:55,2d50385f-4035-47f6-a8e4-66427c9dc980,End,

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Thanks Dave, I know this solution, but I am afraid that with processes with a large number of logs, frequent queries to the database may be too expensive. Anyway, it's the best solution at this moment.

------------------------------
Tomasz Sukiennik
RPA Developer
Digital Teammates
Europe/Lodz
------------------------------