Retrieve ServiceNow Table Record

Action ID: servicenow:now:table:retrieveRecord
NPM Package:

@backstage-community/plugin-scaffolder-backend-module-servicenow

Description

Retrieves the record identified by the specified sys_id from the specified table

Input Schema

PropertyTypeDescriptionRequired
sysIdstring-
tableNamestring-
sysparmViewstring-
sysparmFieldsarray-
sysparmDisplayValuestring-
sysparmQueryNoDomainboolean-
sysparmExcludeReferenceLinkboolean-

Output Schema

No output schema defined for this action.

Usage Examples

Retrieve an incident by sys_id with default options

Retrieves the full incident record using only required inputs. Use this when you need the complete record as stored in ServiceNow.

Copy
steps:
  - id: fetchBase
    action: fetch:template
    input:
      url: https://github.com/example-org/templates/service-skeleton/archive/main.zip
      targetPath: .

  - id: getIncident
    action: servicenow:now:table:retrieveRecord
    input:
      tableName: incident
      sysId: 46d44f64db8c9010d931f58d1f9619c0

  - id: logDone
    action: debug:log
    input:
      message: Retrieved incident record

Retrieve specific incident fields with display values

Fetches selected fields from an incident and returns human readable display values while removing reference links. Use this to display key details in logs or summaries.

Copy
steps:
  - id: fetchBase
    action: fetch:template
    input:
      url: https://github.com/example-org/templates/service-skeleton/archive/main.zip
      targetPath: .

  - id: getIncidentSummary
    action: servicenow:now:table:retrieveRecord
    input:
      tableName: incident
      sysId: ${{ parameters.incidentSysId }}
      sysparmFields:
        - number
        - short_description
        - state
        - caller_id
      sysparmDisplayValue: "true"
      sysparmExcludeReferenceLink: true

  - id: logSummary
    action: debug:log
    input:
      message: Retrieved incident summary for provided sys_id
  • Demonstrates parameterized sys_id and the use of sysparmFields, sysparmDisplayValue, and sysparmExcludeReferenceLink.

Retrieve a change request with all display and actual values

Returns a change request including both display and raw values and uses a specific view. Use this to get comprehensive field representations for auditing or downstream processing.

Copy
steps:
  - id: fetchBase
    action: fetch:template
    input:
      url: https://github.com/example-org/templates/change-service/archive/main.zip
      targetPath: .

  - id: getChangeRequest
    action: servicenow:now:table:retrieveRecord
    input:
      tableName: change_request
      sysId: 9f1a2b3c4d5e67890123abcd4567ef01
      sysparmDisplayValue: "all"
      sysparmView: ess

  - id: logChange
    action: debug:log
    input:
      message: Retrieved change request with display and raw values

Retrieve a CMDB server record across domains

Retrieves a CMDB CI server record while ignoring domain constraints and returns a minimal set of fields. Use this in domain separated instances where cross domain access is required.

Copy
steps:
  - id: fetchBase
    action: fetch:template
    input:
      url: https://github.com/example-org/templates/infra-service/archive/main.zip
      targetPath: .

  - id: getServerCi
    action: servicenow:now:table:retrieveRecord
    input:
      tableName: cmdb_ci_server
      sysId: 1a2b3c4d5e6f7890abcdeffedcba9876
      sysparmFields:
        - name
        - sys_class_name
        - operational_status
        - owned_by
      sysparmDisplayValue: "false"
      sysparmQueryNoDomain: true

  - id: logCi
    action: debug:log
    input:
      message: Retrieved CMDB CI server record across domains

Retrieve a user record with raw reference values

Gets a sys_user record using template parameters and keeps reference fields as sys_ids while including reference links. Use this to programmatically follow reference links later.

Copy
steps:
  - id: fetchBase
    action: fetch:template
    input:
      url: https://github.com/example-org/templates/identity-service/archive/main.zip
      targetPath: .

  - id: getUser
    action: servicenow:now:table:retrieveRecord
    input:
      tableName: ${{ parameters.userTableName }}
      sysId: ${{ parameters.userSysId }}
      sysparmFields:
        - name
        - email
        - department
        - manager
      sysparmDisplayValue: "false"
      sysparmExcludeReferenceLink: false

  - id: logUser
    action: debug:log
    input:
      message: Retrieved user record with raw reference values
  • The table name and sys_id are supplied by template parameters to support different user tables such as sys_user or a custom extended table.