HostnameJS - Global
concept australia Updated Sep 10, 2026 1 min read c_HostnameJSAPI.md
The HostnameJS script include provides methods to format host names according to property settings.
Use with any server-side script when you need to format host names.
Parent Topic:Server API reference
HostnameJS - format(String hostname, String source)
Formats the specified host name according to the property settings.
| Name | Type | Description |
|---|---|---|
| hostname | String | The host name to format |
| source | String | The property settings source |
| Type | Description |
|---|---|
| String | The system name |
HostnameJS - getDomainName()
Returns the DNS domain name.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | The domain name |
JavaScript
var hjs = new HostnameJS();hjs.getDomainName();HostnameJS - getSysName()
Returns the current system name.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | The system name |
JavaScript
var hjs = new HostnameJS();hjs.getSysName();70 lines · 1.8 KB
--- title: HostnameJS - Global description: The HostnameJS script include provides methods to format host names according to property settings.Formats the specified host name according to the property settings.Returns the DNS domain name.Returns the current system name. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/api-reference/server-api-reference/c\_HostnameJSAPI.html release: australia product: Server API Reference classification: server-api-reference topic_type: concept last_updated: "2026-09-10" reading_time_minutes: 1 breadcrumb: [Server API reference, API reference, API implementation and reference] --- # HostnameJS- Global The HostnameJS script include provides methods to format host names according to property settings. Use with any server-side script when you need to format host names. **Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md) ## HostnameJS - format\(String hostname, String source\) Formats the specified host name according to the property settings. |Name|Type|Description| |----|----|-----------| |hostname|String|The host name to format| |source|String|The property settings source| |Type|Description| |----|-----------| |String|The system name| ## HostnameJS - getDomainName\(\) Returns the DNS domain name. |Name|Type|Description| |----|----|-----------| |None| | | |Type|Description| |----|-----------| |String|The domain name| ``` var hjs = new HostnameJS(); hjs.getDomainName(); ``` ## HostnameJS - getSysName\(\) Returns the current system name. |Name|Type|Description| |----|----|-----------| |None| | | |Type|Description| |----|-----------| |String|The system name| ``` var hjs = new HostnameJS(); hjs.getSysName(); ```
| title | HostnameJS - Global |
| description | The HostnameJS script include provides methods to format host names according to property settings.Formats the specified host name according to the property settings.Returns the DNS domain name.Returns the current system name. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/australia/api-reference/server-api-reference/c\_HostnameJSAPI.html |
| release | australia |
| product | Server API Reference |
| classification | server-api-reference |
| topic_type | concept |
| last_updated | 2026-09-10 |
| reading_time_minutes | 1 |
| breadcrumb | Server API referenceAPI referenceAPI implementation and reference |