4699
Views
18
Comments
Solved
Re : How to get current server Name?
Question
Is there a action/function to get current servername in a Timer action? (not localhost)

Kind regards,

Matthias Preuter
2018-11-07 10-43-31
Hugo Pinheiro
Staff
Solution
Hello,
The action that you need on the 6.0 version is now available on rich widgets eSpace.

Kind Regards,
Hugo Pinheiro
UserImage.jpg
Keya  Madhukar

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


2018-11-07 10-43-31
Hugo Pinheiro
Staff

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

UserImage.jpg
Keya  Madhukar

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


2021-08-30 14-04-44
Maykon Nogueira

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


Thanks for the information.

2024-12-17 14-32-59
Matthias Preuter
 
MVP
Solution

You don't even have to create a extension. the CurrentServerName, is registered in the system Parameter entity, reference the entity and you can use a Aggregate and filter on 

Parameter.Name = "DefaultDNSName"

Will mark this question as Solved and Close the Post now; 

Happy Low Coding!

2017-10-02 14-22-21
Paulo Tavares
Staff
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
2018-09-22 14-36-02
Kurt Vandevelde
 
MVP
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
2017-10-02 14-22-21
Paulo Tavares
Staff
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
2018-11-07 10-43-31
Hugo Pinheiro
Staff
Solution
Hello,
The action that you need on the 6.0 version is now available on rich widgets eSpace.

Kind Regards,
Hugo Pinheiro
UserImage.jpg
Keya  Madhukar

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


2018-11-07 10-43-31
Hugo Pinheiro
Staff

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

UserImage.jpg
Keya  Madhukar

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


2021-08-30 14-04-44
Maykon Nogueira

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


Thanks for the information.

UserImage.jpg
Sattibabu Vatti
hi,

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


Regards,
sattibabu vatti.
UserImage.jpg
Zaida Pires

Hello.

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

Regards,
Zaida Pires

2018-11-07 10-43-31
Hugo Pinheiro
Staff
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
2017-03-28 10-50-47
Paul.

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

2018-11-07 10-43-31
Hugo Pinheiro
Staff

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

UserImage.jpg
Joseph Lucca

I was able to get the current server name via the function GetRequestDomain from the system component HTTPRequestHandler. see below the information returned from several functions from that particular API, for an example: 


To reference this action just open the dependencies manager and select the function for you to be able to use it in your code:


UserImage.jpg
Tom Rowland

 GetRequestDomain does not answer the question in the OP as it returns localhost when called from a timer action.

2019-02-07 16-31-11
Yuri Murakami

Sorry for reviving an old post but feel free to try out this new component that solves this even inside BPTs, Timers, etc, anywhere you may need.

https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=11293&ProjectName=get-server-url-dynamically

2019-10-27 01-32-56
Caio Santana Magalhães
 
MVP

This thread is over a decade old, but still highly ranked when searching for "OutSystems current server name" or "OutSystems machine name".

Nowadays, you have the option to create an Action in a XIF that returns the MachineName property of the .NET System.Environment class. It matches the same name shown under Service Center > Environment Health, as well as the data in the Server entity from (System).

/// <summary>
/// Returns the name of the current server.
/// </summary>
/// <param name="ssServerName">Current server name.</param>
public void MssCurrentServerName(out string ssServerName) {
	ssServerName = Environment.MachineName;
} // MssCurrentServerName

Tested it and it also works in non-user contexts (e.g. Timers).


2024-12-17 14-32-59
Matthias Preuter
 
MVP
Solution

You don't even have to create a extension. the CurrentServerName, is registered in the system Parameter entity, reference the entity and you can use a Aggregate and filter on 

Parameter.Name = "DefaultDNSName"

Will mark this question as Solved and Close the Post now; 

Happy Low Coding!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.