Hostname
The Hostname() function returns the domain name of the active portal of your published WEM project.
For more information about the domain name visit https://en.wikipedia.org/wiki/Domain_name.
This function can be used to create links to (specific pages of) your application. For example a link in a reset password or create account e-mail (see syntax for an example). By using the hostname function you ensure that the generated link always points to the right portal in the right environment.
Portals/applications can have multiple hostnames, and this function will return the Hostname which was used at the first incoming external Request (from a user session).
This function is SQL compatible - as it is a constant value within a session. For more information about SQL compatibility, see our documentation.
When the flow is called within a non-user context, the result can be an internal value.
For example in WEM-Native Scheduled Tasks on Kubernetes, if you are using the Hostname() function and you expect it to return the external portal hostname - you will be surprised that it returns "applicationservice" because of the internal context in which Scheduled Tasks on Kubernetes run.
Scheduled Tasks do NOT run in the context of the external hostname.
So - if you have a Scheduled Task in which you want to set a value with the hostname of your application, you need to use a specific value and cannot use the Hostname() function.
Returns a text that contains the hostname of the portal in its particular runtime environment when used.
Syntax
Hostname()
Hostname()
=> portalname.staging.wem.io (on staging runtime)
=> portalname.live.wem.io (on live runtime)
=> yourcustomhostname.extension (on live runtime)
=> applicationservice (when used in WEM Scheduled Task on Kubernetes Runtime)
"https://" + Hostname() + "/create-account"
=> https://portalname.staging.wem.io/create-account (on staging runtime)
=> https://portalname.live.wem.io/create-account (on live runtime)
=> https://applicationservice/create-account (when used in WEM Scheduled Task on Kubernetes Runtime)
Last updated
Was this helpful?