Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Custom credentials

Custom credentials

ServiceNow supports several credential types by default, such as SSH or SNMP.

Users with the admin role can create a custom credential type. After you create a Custom credential, the type is available for configuration in the same manner as other Credential types. The capability to create a custom credential type is available for Discovery and Orchestration.

Create custom table for custom credentials

You can create custom credentials, which must have a custom table to manage them.

Before you begin

Role required: admin

About this task

Create a custom table with the following requirements:
  • The Table Name: must end with "_credentials". For example my_custom_credentials.
  • The Extends Table value is Credentials [discovery_credentials].

Create a custom credential type with a MID server script

A custom credential type requires a MID Server script include to process the new credential type.

Before you begin

Role required: admin

Procedure

  1. Navigate to MID Server > Script Includes.
  2. Click New.
  3. Create a script that extends the AProbe class and specify a run function that meets this criteria:
    • Class: Probe
    • ECC queue type: JavascriptProbe
    • ECC queue name: A JavaScript class name, for example, CustomCredTypeTestProbe
    For example, this script include creates the iterator credentials containing all credentials with a Value of customtype. This example does not show the JavaScript code to evaluate each credential.
    var CustomCredTypeTestProbe = Class.create();
    
    CustomCredTypeTestProbe.prototype = Object.extendsObject(AProbe, {
    
      initialize : function(probe) {
        this.probe = probe;
      },
    
      run : function() {
    
    // Use the Value specified by the credential type choice for the string parameter of the getCredentials method.
    var credentials = this.getCredentials("customtype");
    
    while (credentials.hasNext()) {
    
      var credential = credentials.next(); // Iterate through each credential.
      try {
    	   ms.log('Attempting to log in with user: ' + credential.getUsername());
    	
    		// Try each credential.
    		// This code varies based on your login requirements.
    	
    	
    		// If successful, add the credential to the credential affinity table.
    		// Credentials added to this table are preferentially used for later login attempts.
    		credentials.worked(this.getParameter("probe"));
    
      } catch (ex) {
        throw ex;
      }
    }
    },
    
      type: "CustomCredTypeTestProbe"
    });
    

Add a custom credential type to the choice list

You can add a custom credential type to the choice list so it can appear on the Credentials form.

Before you begin

Role required: admin

Procedure

Create a new Choice record with these values:
  • Table: The new table that supports custom credentials.
  • Element: The type name.
  • Value: The parameter used by the script include getCredentials method.