Skip to main content
Question

Retrieving client/device IP adress via SF or SQL

  • January 15, 2026
  • 3 replies
  • 72 views

Forum|alt.badge.img+1

Hi all,

We would like to check whether it is possible in SQL or somewhere within the Software Factory to retrieve the IP address of the device that a user is currently working on.

In our warehouse, employees work on tablets that are placed on carts, each cart having a dedicated label printer underneath. Our goal is to automatically link the correct printer to the tablet that is being used, based on the tablet’s IP address. This way, the label will always be printed on the correct printer without manual selection.

We have already written some SQL code to retrieve the IP address, but when we execute it we only get the IP address of the webserver (or application server), instead of the IP address of the individual tablet/client device.

We also checked the Thinkwise documentation about generated session variables, but we were not able to get it working and we are not sure if this is the correct approach for our use case:
https://docs.thinkwisesoftware.com/docs/sf/business_logic#generated-session-variables

At the moment, we cannot find a way to obtain the tablet’s IP address from within the SF or SQL, and we are not sure if this is technically possible at all.

Is there a way to do this?

 

Thanks in advance!

3 replies

Forum|alt.badge.img+2

So you tried getting the tsf_ipv4 session variable? As in select SESSION_CONTEXT(N'tsf_ipv4') || SESSION_CONTEXT(N'tsf_ipv6')

And that does not work? Are the clients maybe obscured by a reverse proxy?


Forum|alt.badge.img+1
  • Author
  • Rookie
  • January 16, 2026

Thanks for the response, ​@Sebastiaan Meijerink 

I tested it in SSMS and noticed the following:

  • select SESSION_CONTEXT(N'tsf_ipv4') returns NULL

  • select SESSION_CONTEXT(N'tsf_original_login') also returns NULL

  • However, dbo.tsf_original_login() does return a value when executed in SSMS.

So it looks like the SESSION_CONTEXT values are not being set when running the query directly in SSMS.

Is that expected behaviour? And does this mean it only works correctly when it’s executed through the application (assuming the proxy setup is correct)?

Also, do you know if this works on Android devices as well? We run the Universal app on those tablet devices installed via the menu in the universal.

Thanks!

 


AndreKemmeren
Captain
Forum|alt.badge.img+3

@Mathijn.Smits Yes the session_context is set via the Application. So when running it from SSMS it will be null, you can set them manually for debugging purposes. 

The tsf_original_login returns a value but this value is not representative of the normal value.