Logo: Schema Discovery

Schema Discovery

Organisatioun
Happy-Technologies-LLC
schema-discovery

Explore and understand ServiceNow table schemas, field definitions, and relationships

Iwwersiicht

EditeurHappy-Technologies-LLC
Repositoryhappy-platform-skills
Skill-Nummschema-discovery
Stären
41
Forks
14
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Happy-Technologies-LLC huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Schema Discovery an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/Happy-Technologies-LLC/happy-platform-skills/tree/main/skills/admin/schema-discovery
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Happy-Technologies-LLC/happy-platform-skills.git /tmp/happy-platform-skills
mkdir -p .claude/skills
cp -r /tmp/happy-platform-skills/skills/admin/schema-discovery .claude/skills/schema-discovery
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Schema Discovery an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Schema Discovery automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Schema Discovery net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Schema Discovery

Overview

Schema discovery is the foundation of effective ServiceNow development. This skill teaches you how to explore table structures, understand field types, discover relationships between tables, and document your findings for development work.

  • What problem does it solve? Eliminates guesswork when working with unfamiliar tables, prevents field type errors, and reveals hidden relationships between ServiceNow entities
  • Who should use this skill? Developers, administrators, and integrators who need to understand ServiceNow data structures before creating queries, scripts, or integrations
  • What are the expected outcomes? Complete understanding of table schemas, field configurations, reference relationships, and proper field usage

Prerequisites

  • Required ServiceNow roles: admin or personalize_dictionary (for full schema access)
  • Read access to sys_dictionary, sys_db_object, and sys_documentation tables
  • Basic understanding of ServiceNow table hierarchy and field types
  • Related skills: None required (this is foundational)

Procedure

Step 1: Discover Available Tables

Start by exploring what tables are available in your ServiceNow instance. Tables are organized into categories based on their function.

If using MCP tools:

Tool: SN-List-Available-Tables
Parameters:
  category: core_itsm

Available categories:

  • core_itsm - Incident, Problem, Change, Request
  • cmdb - Configuration Management Database tables
  • service_catalog - Catalog items, variables, requests
  • security - Users, groups, roles, ACLs
  • system - System properties, scheduled jobs, update sets
  • custom - Custom application tables (x_* prefix)

If using REST API:

bash
GET /api/now/table/sys_db_object?sysparm_query=super_class.name=task^ORsuper_class.name=cmdb_ci&sysparm_fields=name,label,super_class&sysparm_limit=50

Decision Points:

  • If looking for ITSM tables → Use category core_itsm
  • If exploring CMDB → Use category cmdb
  • If working on custom app → Use category custom or query by scope prefix

Step 2: Get Table Schema

Once you identify the table, retrieve its complete schema including all fields, types, and configurations.

If using MCP tools:

Tool: SN-Get-Table-Schema
Parameters:
  table_name: incident

If using REST API:

bash
GET /api/now/table/sys_dictionary?sysparm_query=name=incident^internal_type!=collection&sysparm_fields=element,column_label,internal_type,max_length,mandatory,reference

Expected Response Fields:

FieldDescription
elementInternal field name
column_labelDisplay label
internal_typeField type (string, reference, integer, etc.)
max_lengthMaximum character length
mandatoryWhether field is required
referenceTarget table for reference fields
default_valueDefault value if any
choiceWhether field uses choice list

Step 3: Deep Schema Discovery with Relationships

For complex integrations, discover the full relationship map including parent tables, child tables, and reference chains.

If using MCP tools:

Tool: SN-Discover-Table-Schema
Parameters:
  table_name: incident
  include_relationships: true
  depth: 2

If using REST API:

bash
# Get table hierarchy (parent/child)
GET /api/now/table/sys_db_object?sysparm_query=name=incident&sysparm_fields=name,super_class,label

# Get all reference fields
GET /api/now/table/sys_dictionary?sysparm_query=name=incident^internal_type=reference&sysparm_fields=element,reference

# Get tables that reference this table
GET /api/now/table/sys_dictionary?sysparm_query=reference=incident&sysparm_fields=name,element

Relationship Types to Discover:

RelationshipDescriptionExample
InheritanceParent table hierarchyincident extends task
ReferenceForeign key relationshipincident.assigned_to -> sys_user
Glide ListMulti-value referenceincident.watch_list -> sys_user (list)
Document IDDynamic table referencesys_attachment.table_sys_id

Step 4: Understand Field Types

Different field types have different behaviors, storage characteristics, and query syntax.

Common ServiceNow Field Types:

Type CodeType NameDescriptionQuery Example
stringStringText up to max_lengthshort_description=test
integerIntegerWhole numberspriority=1
booleanTrue/FalseBoolean valuesactive=true
referenceReferenceFK to another tableassigned_to.name=admin
glide_dateDateDate onlydue_date>2024-01-01
glide_date_timeDate/TimeDate with timesys_created_on>=javascript:gs.daysAgo(7)
choiceChoicePredefined optionsstate=1
journalJournalAppend-only textCannot query directly
journal_inputJournal InputWork notes/commentswork_notesLIKEupdate
scriptScriptJavaScript codeN/A
conditionsConditionsEncoded queryN/A

Step 5: Get Field Documentation

For unfamiliar fields, get detailed documentation including usage examples and best practices.

If using MCP tools:

Tool: SN-Explain-Field
Parameters:
  table_name: incident
  field_name: impact

If using REST API:

bash
# Get field definition
GET /api/now/table/sys_dictionary?sysparm_query=name=incident^element=impact&sysparm_fields=element,column_label,internal_type,comments,hint

# Get field documentation
GET /api/now/table/sys_documentation?sysparm_query=name=incident^element=impact&sysparm_fields=text,short_description

Documentation Includes:

  • Field purpose and business meaning
  • Valid values (for choice fields)
  • Related fields and dependencies
  • Common use cases
  • API behavior notes

Step 6: Explore Choice Values

For choice fields (dropdowns), discover all valid values and their meanings.

If using MCP tools:

Tool: SN-Query-Table
Parameters:
  table_name: sys_choice
  query: name=incident^element=state
  fields: value,label,sequence

If using REST API:

bash
GET /api/now/table/sys_choice?sysparm_query=name=incident^element=state&sysparm_fields=value,label,sequence&sysparm_orderby=sequence

Common Choice Tables:

TablePurpose
sys_choiceStandard field choices
question_choiceCatalog variable choices
sys_choice_setReusable choice sets

Step 7: Document Findings

Create a schema reference document for your development work.

Schema Documentation Template:

markdown
## Table: incident

### Hierarchy
- Parent: task
- Children: None

### Key Fields
| Field | Type | Required | Reference | Notes |
|-------|------|----------|-----------|-------|
| number | string | auto | - | Auto-generated |
| short_description | string | yes | - | Max 160 chars |
| assigned_to | reference | no | sys_user | Can be empty |
| state | integer | yes | - | Choice: 1-8 |

### State Values
| Value | Label |
|-------|-------|
| 1 | New |
| 2 | In Progress |
| 3 | On Hold |
| 6 | Resolved |
| 7 | Closed |
| 8 | Canceled |

### Key Relationships
- assignment_group -> sys_user_group
- caller_id -> sys_user
- cmdb_ci -> cmdb_ci
- problem_id -> problem

Tool Usage

MCP Tools (Claude Code/Desktop)

ToolPurposeWhen to Use
SN-List-Available-TablesList tables by categoryStarting exploration
SN-Get-Table-SchemaGet field definitionsUnderstanding table structure
SN-Discover-Table-SchemaDeep relationship discoveryComplex integrations
SN-Explain-FieldGet field documentationUnfamiliar fields
SN-Query-TableQuery sys_choice, sys_dictionaryCustom schema queries

REST API (ChatGPT/Other)

EndpointMethodPurpose
/api/now/table/sys_db_objectGETList tables
/api/now/table/sys_dictionaryGETGet field definitions
/api/now/table/sys_choiceGETGet choice values
/api/now/table/sys_documentationGETGet field documentation
/api/now/table/sys_glide_objectGETGet field type definitions

Native Tools (Claude Code)

ToolPurpose
BashExecute curl commands for REST API
ReadRead cached schema files

Best Practices

  • Cache Schema Information: Schema rarely changes - cache results locally to reduce API calls
  • Start with Parent Tables: Understand task before incident, cmdb_ci before cmdb_ci_computer
  • Check Both sys_dictionary and sys_db_object: Dictionary has fields, db_object has table metadata
  • Document Reference Chains: incident -> assignment_group -> sys_user_group helps in dot-walking
  • Verify in Dev First: Schema may differ between instances due to customizations
  • Use Encoded Query Builder: Test queries in ServiceNow UI before coding them

Troubleshooting

Common Issue 1: Missing Fields in Schema

Symptom: Expected field not appearing in schema results Cause: Field may be on parent table, not child table Solution: Query parent table or use SN-Discover-Table-Schema with depth parameter

Tool: SN-Discover-Table-Schema
Parameters:
  table_name: incident
  include_parent_fields: true

Common Issue 2: Permission Denied on sys_dictionary

Symptom: 403 error when querying sys_dictionary Cause: Missing personalize_dictionary or admin role Solution: Request appropriate role or use table-specific endpoints

bash
# Alternative: Use table API with schema
GET /api/now/table/incident?sysparm_limit=1&sysparm_display_value=all
# Response headers include field metadata

Common Issue 3: Reference Field Shows sys_id Not Value

Symptom: Reference fields return sys_id instead of display value Cause: Not using sysparm_display_value parameter Solution: Add display_value parameter to query

Tool: SN-Query-Table
Parameters:
  table_name: incident
  display_value: all

Common Issue 4: Choice Values Not Found

Symptom: sys_choice returns empty for a choice field Cause: Field uses choice set or is defined differently Solution: Check sys_choice_set or query with dependent value

Tool: SN-Query-Table
Parameters:
  table_name: sys_choice
  query: name=incident^element=subcategory^dependent_value=network

Examples

Example 1: Discover CMDB Computer Schema

# Step 1: List CMDB tables
Tool: SN-List-Available-Tables
Parameters:
  category: cmdb

# Result: Lists cmdb_ci, cmdb_ci_computer, cmdb_ci_server, etc.

# Step 2: Get cmdb_ci_computer schema
Tool: SN-Get-Table-Schema
Parameters:
  table_name: cmdb_ci_computer

# Result:
Fields:
- cpu_core_count (integer)
- cpu_count (integer)
- cpu_speed (float)
- disk_space (float)
- ram (integer)
- os (string)
- os_version (string)
- serial_number (string)
- [inherited from cmdb_ci: name, ip_address, manufacturer, etc.]

# Step 3: Understand OS field
Tool: SN-Explain-Field
Parameters:
  table_name: cmdb_ci_computer
  field_name: os

# Result:
- Type: String
- Label: Operating System
- Description: Operating system name
- Common values: Windows, Linux, macOS
- Related field: os_version

Example 2: Map Incident Reference Relationships

# Discover all relationships from incident table
Tool: SN-Discover-Table-Schema
Parameters:
  table_name: incident
  include_relationships: true
  depth: 2

# Result:
Table: incident
Extends: task

Reference Fields:
- assigned_to -> sys_user
  - sys_user.manager -> sys_user (depth 2)
  - sys_user.department -> cmn_department (depth 2)
- assignment_group -> sys_user_group
  - sys_user_group.manager -> sys_user (depth 2)
  - sys_user_group.parent -> sys_user_group (depth 2)
- caller_id -> sys_user
- cmdb_ci -> cmdb_ci
  - cmdb_ci.location -> cmn_location (depth 2)
  - cmdb_ci.support_group -> sys_user_group (depth 2)
- problem_id -> problem
- rfc -> change_request

Reverse References (tables referencing incident):
- incident_sla.task -> incident
- incident_alert.incident -> incident
- sc_task.incident -> incident

Example 3: Catalog Variable Schema Discovery

# Step 1: Get catalog variable types
Tool: SN-Query-Table
Parameters:
  table_name: sys_choice
  query: name=item_option_new^element=type
  fields: value,label

# Result:
- 1: Yes/No
- 2: Multi Line Text
- 3: Multiple Choice
- 4: Numeric Scale
- 5: Select Box
- 6: Single Line Text
- 7: CheckBox
- 8: Reference
- 9: Date
- 10: Date/Time
- etc.

# Step 2: Understand variable definition structure
Tool: SN-Get-Table-Schema
Parameters:
  table_name: item_option_new

# Result:
- name (string): Variable name
- question_text (string): Label shown to user
- type (integer): Variable type from above
- reference (string): For type 8, target table
- cat_item (reference): Parent catalog item
- order (integer): Display sequence
- mandatory (boolean): Required field

Example 4: Custom Application Table Discovery

# List custom tables in specific scope
Tool: SN-Query-Table
Parameters:
  table_name: sys_db_object
  query: nameSTARTSWITHx_myapp_
  fields: name,label,super_class

# Result:
- x_myapp_request (label: My App Request, extends: task)
- x_myapp_config (label: Configuration, extends: none)
- x_myapp_log (label: Activity Log, extends: none)

# Get schema for custom table
Tool: SN-Get-Table-Schema
Parameters:
  table_name: x_myapp_request

# Discover custom table relationships
Tool: SN-Discover-Table-Schema
Parameters:
  table_name: x_myapp_request
  include_relationships: true

Related Skills

  • admin/update-set-management - Managing update sets during development
  • admin/batch-operations - Creating multiple records using schema knowledge
  • development/business-rules - Writing scripts that use discovered fields
  • development/scripted-rest-apis - Building integrations based on schema

References

Heefeg gestallte Froen

Wat mécht de KI-Skill Schema Discovery?

Explore and understand ServiceNow table schemas, field definitions, and relationships

Firwat Schema Discovery op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Schema Discovery besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Schema Discovery an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/Happy-Technologies-LLC/happy-platform-skills/tree/main/skills/admin/schema-discovery an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Schema Discovery benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Schema Discovery benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Schema Discovery domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Schema Discovery gratis?

Jo. Happy-Technologies-LLC huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇