Skip to Content

How can i know country from logged user in an ui5 application?

im developing an application and i need to retrieve employees records from a specific country(with same language and time zone) using a odata, but i dont know what approach i have to use:

-the user in frontend select the country and this parameter is passed to backend, after that is performed the filter by country and the employess from the selected country are displayed on screen.

-the user doesnt select country, the backend retrieves employees records from the country of the logged user, using some variable (that i dont know what it is)

thank for your help

Add comment
10|10000 characters needed characters exceeded

  • more business context please....

  • the scenario is the following :

    -the company is in three countries.

    -the application is for assign one car to one employee

    -the person who makes the assignment lives in the same country that the employee

    -the user from application is the person who makes the assignment. There is one person from country for the car assignment

    - as a user from this application , i want to display the cars and the employees from my country

  • Follow
  • Get RSS Feed

2 Answers

  • Mar 19 at 10:37 AM

    Hello Maria, hope you're well.

    If you want to have access to exactly country user is located, you might use some localization service, such as maxmind.com or ipinfo.io.

    Anyhow - and depending the business context that you're into, you may also go throught moment.js external library in order to get latitude and longitude properties of users location. The library extracts geolocation properties based on browser settings.

    See more about moment.js and UI5 in https://blogs.sap.com/2017/04/30/how-to-include-third-party-libraries-modules-in-sapui5/

    Take care :)

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 21 at 01:16 AM

    pa0006 contains employee address data, where you can find the country information.

    for filtering, you will use DCL if you use cds

    the user who is doing assignment will have a profile assigned which allows him/her to access to certain country based on the configuration.

    Add comment
    10|10000 characters needed characters exceeded