Question
Nationwide Building Society
GB
Last activity: 11 Mar 2020 17:36 EDT
Current Logged on User to Robot
Hi,
Can anyone advise what I need to have on my automation in order to determine who the current user of the Pega runtime is.....so not who is logged on to the physical machine (which I would use "CurrentUser for), but the username/group logged into the runtime?
Many thanks
Paul
-
Likes (1)
Ajit Deshpande -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
There is a CurrentUser component available in the Toolbox on the Advanced tab. It has a property called "Name" that returns; Domain\Username. You can also use several different static methods from the Global Assembly Cache if you are familiar with that.
Nationwide Building Society
GB
Thanks @tsasnett.
I've tried the CurrentUser component, but that only returns the person signed on to the actual machine. I was looking for a component which returned who the actual user of the robot was at the time. The users of the Pega Runtime are signed in as a group, so I'd like to know that setting.
I'm not that familiar with the Global Assembly - are you able to point me to the right place?
Many thanks
Paul
Pegasystems Inc.
US
To add a static property or nmethod from the Global Assembly Cache (GAC), right-click on an empty area in the Toolbox (with an automation open). Select "Choose Items...". Select the "Pega Robot Static Members" tab. From here, select the "From Global Assembly Cache" check box. Select the "mscorlib" assembly from the combo box. Locate the "Environment" node and check the checkbox next to "UserName" beneath it. Click "Ok". Now you can drag this out to use in an automation.
-
Ajit Deshpande
Pegasystems Inc.
US
Adding a screenshot.
Flex
IN
Hi,
Tried with these steps, but getting the username who is logged in on computer and not the pega runtime user
Pegasystems Inc.
US
According to Microsoft, Environment.UserName will return the owner of the current process thread. I do not have a way to test this as my laptop only has a single user. The StackOverflow thread seems to indicate by the poster that it also returns the user running the process.
https://docs.microsoft.com/en-us/dotnet/api/system.environment.username?view=netframework-4.8
Nationwide Building Society
GB
Great - many thanks.