---
sourceDocument: Australia IT Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/it-service-management

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia IT Service Management

ft:clusterId :

    - itsm

bundleId :

    - itsm

workflow :

    - Technology


---

# Delete orphan connection and credential aliases

# Delete orphan connection and credential aliases {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read  
Delete the connection and credential aliases that do not label any connection or
credential record by running a background script. This helps you in freeing up space in your
system.

## Before you begin

Role required: System Admin (admin)

## Procedure

1. Navigate to AllSystem DefinitionsScripts - Background.
2. Select the scope as global.
3. Enter the following script in the Run script (JavaScript executed on server) pane.  

       deleteOrphanAliases();
       function deleteOrphanAliases() {
           var orphanAliases = new GlideRecord('sys_alias');
           orphanAliases.addEncodedQuery("nameSTARTSWITHDevOps-_-");
           orphanAliases.query();
           while(orphanAliases.next()) {
               if (!checkIfAliasHasConnection(orphanAliases.getUniqueValue()))
                   orphanAliases.deleteRecord();
           }
       };
       function checkIfAliasHasConnection(sysAliasId) {
           var httpToolConnGR = new GlideRecord("http_connection");
           httpToolConnGR.addEncodedQuery("connection_alias=" + sysAliasId);
           httpToolConnGR.query();
           if (httpToolConnGR.next())
               return true;
           return false;
       };

4. Select Run script.

*[\>]: and then


