Highlighted
Absent Member.
Absent Member.
259 views

Get current log in user location value

Hello!
I have an issue about getting current login user location attribute value. Which command or script should I use to get this attribute? For example, I use command "user.role in $lo.operator" for getting user role of current operator. Can I use similar command for getting location?

0 Likes
2 Replies
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: Get current log in user location value

Hello Viklo!

As far as I know the location field is in the corresponding contact record. You could get the info via javascript.

var contactname = vars['$lo.operator']['contact.name'];
var ret = system.library.userUtils.findContactByField('contact.name', contactname);
if (ret) {
  print(ret['location']);
}

Best regards,

Bo

 

 

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Get current log in user location value

If you're trying to get a location field value based on the current user's contact address, then @bogart's method is what you want - either through a JS or a query+calc in a formatctrl or other means. Basically use a lookup method to search the contacts table for your user and pull in the field value you want.

If you're using the word "location" to mean "the actual location from where the user is accessing the system", that will be trickier. It will depend on how your requirements define "location", or what would satisfy your requirements' needs. For example, the RAD function sysinfo.get("ClientNetAddress") will return the actual IP of the current user.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.