Re : How to get current server Name?

Re : How to get current server Name?

  
Is there a action/function to get current servername in a Timer action? (not localhost)

Kind regards,

Matthias Preuter
Hi Matthias,

Would storing the server name in a Global Property suit your need? That is a common way to do so in some installations we have. Or is it expected to change?

You could bootstrap it in a request, using an action we have in HTTPRequestHandler (GetServerName, if I'm not mistaken).

Regards,

Paulo Tavares
Hi Paulo,

I'm using version 6.0.0.9 of service studio and I don't find the GetServerName function in the HTTPRequestHandler. I have a table with information for each servers. I need to fetch some data for the server the espace is running on.

What 's the best way?

Kurt
Hi Kurt,

I have to say I don't have access to a 6.0 version at the moment. That being said, I would find it curious if they had removed such a method from the extension.

According to the extension page, HTTPRequestHandler now comes built into the Platform, so maybe you just need to go to Add/Remove References, and see if there is a similar method there.

If not, I'm sure that someone out here using 6.0 has already gone through that ;)

In a last resort, I would guess that it would be easy to code it in an extension method, just to return the server name.

Hope this helps, and let us know how it goes.

Paulo Tavares
Solution
Hello,
The action that you need on the 6.0 version is now available on rich widgets eSpace.

Kind Regards,
Hugo Pinheiro
Solution
hi,

please anybody tell me how to get server name exactly..


Regards,
sattibabu vatti.

Hello.

On the version 6.0, on Rich Widgets there is an action (called GetServerName) that returns the server name.

Regards,
Zaida Pires

Zaida Pires wrote:

Hello.

On the version 6.0, on Rich Widgets there is an action (called GetServerName) that returns the server name.

Regards,
Zaida Pires

 
 Hi, is also on same place on version 7.0.

 Regards,
 Hugo Pinheiro

Here's an other way to check your domain name / ip-address.


First get the URL with the action "GetURL".
(If you don't see this action, make sure you have it's reference added to your application. It can be found in the HTTPRequestHandler producer.)

Then you can use the return value of this GETURL action in an IF statement to check if a certain IP or domain name is part of it's URL.


Code Snippet IF statement

Index(GetURLName.URL,"1.1.1.1") = -1


If the IP address you are looking for is NOT part of the url it will return the value -1

Hugo Pinheiro wrote:

Hello,
The action that you need on the 6.0 version is now available on rich widgets eSpace.

Kind Regards,
Hugo Pinheiro

Hi Hugo,

I tried this solution. But this doesn't seem to work. 

I am using Outsystems 10.

Regards,

Keya Madhukar


Hello Keya,

where are you trying to use the action? Additionally, there are other options that you can explore, for instance, have a site property with the server url and then have a function to share it with other modules.

Best Regards,

Hugo Pinheiro

Hugo Pinheiro wrote:

Hello Keya,

where are you trying to use the action? Additionally, there are other options that you can explore, for instance, have a site property with the server url and then have a function to share it with other modules.

Best Regards,

Hugo Pinheiro

Hi Hugo,

I am trying to access the same in the client action of a mobile application. Using the GetServerName server action logs a blank string in service center. I do not want to hardcode the server details as I want it to be accessible across all environments (for which the URL can be different). Hence I cannot put it as a site property.

Regards,

Keya Madhukar


Hello Keyta,

you are right, seems that the GetServerName is not working on mobile, also tested and returns an empty string, please open a support case with this. 

Regarding the solution with site properties, yes you need to change it in the different environments, but it's only once.

Best Regards,

Hugo Pinheiro