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?

  • 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

     

     

  • 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.