ServiceNow

How do I find Assignment Group id and User id in ServiceNow?

A unique 32-character GUID identifies each record in ServiceNow (Globally Unique ID) called a sys_id.

sys_id of a record is important when writing a script, workflow, or other development tasks.

Here are ten different methods to find the sys_id of a record in ServiceNow:

  1. Right-click or hamburger
    You can right-click the header bar of most forms and find the sys_id.

    • To get a sys_id from the header bar:

      1. Navigate to the record where you are looking for a sys_id. 

      2. Right-click the header bar and select Copy sys_id. Alternately you can also click the Hamburger > Copy sys_id

     

  2. XML

    • To get a sys_id from XML

      1. Navigate to the record where you are looking for a sys_id

      2. Right click the header bar and select Show XML. Alternately you can also click the Hamburger > Show XML

      3. Scroll down in the XML and find the sys_id line

  3. URL

    Since the sys_id of a record is always part of the URL for a link to that record, it is possible to retrieve the sys_id by viewing the URL.

    • To get the sys_id from XML

      1. Navigate to the record where you are looking for a sys_id
      2. Right-click the header bar and select Copy URL. Alternately you can also click the Hamburger > Copy URL

        For example, an Incident with the following URL:

        https://<instance name>.service-now.com/nav_to.do?uri=incident.do sys_id=23dc968f0a0a3c1900534f399927740e

        • The sys_id is : 23dc968f0a0a3c1900534f399927740e

  4. Client side JavaScript
    You can also get the sys_id from a client-side script
    • Add an onload client script to show a sys_id
      function onLoad() {
      var incSysid = g_form.getUniqueValue();
      alert(incSysid);
      }
  5. Server side JavaScript

    The sys_id value of a record can be found in a business rule (or any other server-side JavaScript)

    var id = current.getValue('sys_id');
  6. Background Script

    The sys_id value of a record can be found in a background script.

    Note: Test in a development instance first!

    • How to use a background script to retrieve a sys_id
      1. Login as an admin

      2. Go to System Definition > Scripts - Background

      3. Paste a script similar to this and click Run Script

        (function() {
        var grCI = new GlideRecord('cmdb_ci');
        grCI.addQuery('name','=','SAP WEB03’);
        grCI.query();
        while (grCI.next()){
        gs.print('CI Name: '+grCI.getValue('name')+ ', Sys ID: ' +grCI.getValue('sys_id'));
        }
        })();


  7.  Export CSV

    By adjusting the url of a record, you can add this URL Parameter to export the sys_id and all fields to CSV

    &CSV&sysparm_default_export_fields=all
  8. Easy import

    Here is a creative way to use the Easy Import Template to export the sys_id data you are looking for.

    1. Navigate to the list of records where you want to find the sys_id

    2. Build your filter

    3. Right click the header bar and select Import. Alternately you can also click the Hamburger > Import

      • Do you want to insert or update data? Update

      • Do you want to create an Excel template to enter data ? True

      • Include all fields in the template? True or False, your choice

    4. Click Create Excel Template

    5. Click Download

    6. Open the Excel Spreadsheet

    7. Select Page 1

    8. In the far-right column, the sys_id is shown

  9. ODBC Driver

    If you are using the ServiceNow ODBC Driver and a reporting tool, you can pull the sys_id field information easily.

    • Install the ODBC Driver. This guide is helpful. After you install the ODBC Driver, you can run a SQL query and depending on the query, the sys_id can be exported.

  10. REST API

    If you are using the ServiceNow Rest API, you can also pull sys_ids

    Destination: GET: <your_instance>.service-now.com/incident.do?JSONv2&sysparm_action=getRecords&sysparm_query=number=INC0000059
    Authentication (Basic) Username/Password
    Headers: Content-Type | application/json


Check this link (external): https://www.servicenowelite.com/blog/2020/9/29/ten-methods-to-find-sysid?rq=sys_ID