---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# HostnameJS - Global

# HostnameJS - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

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.

## HostnameJS - format(String hostname, String source) {#ariaid-title2}

Formats the specified host name according to the property settings.
{#r_HJS-format_S_S__table_lsy_sjq_pt__entry__3}

| Name | Type | Description |
|-|-|-|
| hostname | String | The host name to format |
| source | String | The property settings source |
[Table 1. Parameters]

{#r_HJS-format_S_S__table_lsy_sjq_pt} {#r_HJS-format_S_S__table_msy_sjq_pt__entry__2}

| Type | Description |
|-|-|
| String | The system name |
[Table 2. Returns]

{#r_HJS-format_S_S__table_msy_sjq_pt}

## HostnameJS - getDomainName() {#ariaid-title3}

Returns the DNS domain name.
{#r_HJS-getDomainName__table_w5h_4kq_pt__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 3. Parameters]

{#r_HJS-getDomainName__table_w5h_4kq_pt} {#r_HJS-getDomainName__table_x5h_4kq_pt__entry__2}

| Type | Description |
|-|-|
| String | The domain name |
[Table 4. Returns]

{#r_HJS-getDomainName__table_x5h_4kq_pt}  

    var hjs = new HostnameJS();
    hjs.getDomainName();

## HostnameJS - getSysName() {#ariaid-title4}

Returns the current system name.
{#r_HJS-getSysName__table_lhc_fkq_pt__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 5. Parameters]

{#r_HJS-getSysName__table_lhc_fkq_pt} {#r_HJS-getSysName__table_mhc_fkq_pt__entry__2}

| Type | Description |
|-|-|
| String | The system name |
[Table 6. Returns]

{#r_HJS-getSysName__table_mhc_fkq_pt}  

    var hjs = new HostnameJS();
    hjs.getSysName();


