Generate HR knowledge articles from resolved cases, covering HR policy documentation, benefits FAQs, and onboarding guides
This skill provides a structured approach to generating knowledge articles from resolved HR service delivery cases. It covers:
When to use: When HR teams want to reduce case volume by converting repeated inquiries into self-service knowledge articles, or when policies change and documentation needs to be updated based on recent case handling patterns.
Plugin required: com.sn_hr_core (HR Service Delivery Core)
sn_hr_core.adminsn_hr_core.managerknowledge_adminknowledge_managersn_hr_core_case, sn_hr_core_task; write access to kb_knowledgecom.sn_hr_core and com.glideapp.knowledge must be activatedFind resolved HR cases grouped by topic or case type to discover candidates for knowledge articles.
Using MCP:
Tool: SN-Execute-Background-Script
Parameters:
description: Identify top HR case topics for knowledge article generation
script: |
gs.info('=== HR CASE TOPIC ANALYSIS ===');
// Top case types by volume
gs.info('\n--- Top HR Case Types (Last 90 Days, Resolved) ---');
var ga = new GlideAggregate('sn_hr_core_case');
ga.addQuery('state', 'closed_complete');
ga.addQuery('sys_created_on', '>=', gs.daysAgo(90));
ga.addAggregate('COUNT');
ga.groupBy('hr_service');
ga.orderByAggregate('COUNT', 'DESC');
ga.setLimit(15);
ga.query();
while (ga.next()) {
gs.info('Service: ' + ga.hr_service.getDisplayValue() + ' | Cases: ' + ga.getAggregate('COUNT'));
}
// Frequent short descriptions (common questions)
gs.info('\n--- Most Repeated Case Subjects ---');
var subj = new GlideAggregate('sn_hr_core_case');
subj.addQuery('state', 'closed_complete');
subj.addQuery('sys_created_on', '>=', gs.daysAgo(90));
subj.addAggregate('COUNT');
subj.groupBy('short_description');
subj.orderByAggregate('COUNT', 'DESC');
subj.setLimit(20);
subj.query();
while (subj.next()) {
var count = parseInt(subj.getAggregate('COUNT'));
if (count >= 3) {
gs.info('Subject: ' + subj.short_description + ' | Count: ' + count);
}
}
Pull resolved cases for a specific topic to extract resolution content.
Using MCP:
Tool: SN-Query-Table
Parameters:
table_name: sn_hr_core_case
query: state=closed_complete^short_descriptionLIKE[topic_keyword]^ORDERBYDESCclosed_at
fields: sys_id,number,short_description,description,close_notes,resolution_code,hr_service,subject_person,opened_at,closed_at
limit: 15
Using REST API:
GET /api/now/table/sn_hr_core_case?sysparm_query=state=closed_complete^short_descriptionLIKE[topic_keyword]^ORDERBYDESCclosed_at&sysparm_fields=sys_id,number,short_description,description,close_notes,resolution_code,hr_service,subject_person,opened_at,closed_at&sysparm_display_value=true&sysparm_limit=15
Understand the HR case type taxonomy for proper article categorization.
Using MCP:
Tool: SN-Query-Table
Parameters:
table_name: sn_hr_le_case_type
query: active=true^ORDERBYname
fields: sys_id,name,description,hr_service,topic_category,active
limit: 50
Using REST API:
GET /api/now/table/sn_hr_le_case_type?sysparm_query=active=true^ORDERBYname&sysparm_fields=sys_id,name,description,hr_service,topic_category,active&sysparm_display_value=true&sysparm_limit=50
Identify the HR knowledge base and available categories before creating articles.
Using MCP:
Tool: SN-Query-Table
Parameters:
table_name: kb_knowledge_base
query: titleLIKEHR^ORtitleLIKEHuman Resources
fields: sys_id,title,description,active,owner
limit: 5
Tool: SN-Query-Table
Parameters:
table_name: kb_category
query: kb_knowledge_base=[kb_sys_id]^active=true^ORDERBYlabel
fields: sys_id,label,parent_id,full_category
limit: 50
Create a knowledge article based on the extracted resolution patterns.
Using MCP (Policy Documentation example):
Tool: SN-Create-Record
Parameters:
table_name: kb_knowledge
data:
kb_knowledge_base: [kb_sys_id]
kb_category: [category_sys_id]
short_description: "How to Request Parental Leave"
text: |
<h2>Overview</h2>
<p>This article explains the process for requesting parental leave, including eligibility, duration, and required documentation.</p>
<h2>Eligibility</h2>
<ul>
<li>Full-time employees who have been employed for at least 12 months</li>
<li>Part-time employees working 20+ hours per week for at least 12 months</li>
</ul>
<h2>Leave Duration</h2>
<p>Eligible employees may take up to 12 weeks of parental leave within the first year of a qualifying event (birth, adoption, foster placement).</p>
<h2>How to Submit a Request</h2>
<ol>
<li>Navigate to the HR Service Portal</li>
<li>Select "Leave of Absence" from the catalog</li>
<li>Choose "Parental Leave" as the leave type</li>
<li>Enter the expected start date and duration</li>
<li>Upload supporting documentation</li>
<li>Submit the request for manager approval</li>
</ol>
<h2>Required Documentation</h2>
<ul>
<li>Medical certification (for birth-related leave)</li>
<li>Adoption or foster placement documentation</li>
<li>Completed Leave Request Form (HR-201)</li>
</ul>
<h2>Frequently Asked Questions</h2>
<p><strong>Q: Can I extend my parental leave?</strong></p>
<p>A: Extensions may be available. Contact your HR Business Partner at least 2 weeks before your scheduled return date.</p>
<p><strong>Q: Is parental leave paid?</strong></p>
<p>A: The first 6 weeks are fully paid. Weeks 7-12 are at 60% base pay. Check your benefits summary for details.</p>
workflow_state: draft
valid_to: 2027-12-31
author: [current_user_sys_id]
Using REST API:
POST /api/now/table/kb_knowledge
Content-Type: application/json
{
"kb_knowledge_base": "[kb_sys_id]",
"kb_category": "[category_sys_id]",
"short_description": "How to Request Parental Leave",
"text": "<h2>Overview</h2><p>...</p>",
"workflow_state": "draft",
"valid_to": "2027-12-31"
}
Create FAQ-style articles for common benefits inquiries.
Using MCP:
Tool: SN-Execute-Background-Script
Parameters:
description: Extract benefits-related questions from resolved HR cases for FAQ generation
script: |
gs.info('=== BENEFITS FAQ EXTRACTION ===');
var gr = new GlideRecord('sn_hr_core_case');
gr.addQuery('state', 'closed_complete');
gr.addQuery('hr_service.name', 'LIKE', 'Benefits');
gr.addQuery('sys_created_on', '>=', gs.daysAgo(180));
gr.orderByDesc('sys_created_on');
gr.setLimit(30);
gr.query();
var faqEntries = {};
while (gr.next()) {
var question = gr.short_description.toString();
var answer = gr.close_notes.toString();
if (question && answer) {
if (!faqEntries[question]) {
faqEntries[question] = answer;
gs.info('Q: ' + question);
gs.info('A: ' + answer);
gs.info('---');
}
}
}
Build onboarding content from new-hire case patterns.
Using MCP:
Tool: SN-Execute-Background-Script
Parameters:
description: Identify common onboarding topics from new-hire HR cases
script: |
gs.info('=== ONBOARDING GUIDE TOPICS ===');
var ga = new GlideAggregate('sn_hr_core_case');
ga.addQuery('state', 'closed_complete');
ga.addQuery('hr_service.name', 'LIKE', 'Onboarding');
ga.addQuery('sys_created_on', '>=', gs.daysAgo(180));
ga.addAggregate('COUNT');
ga.groupBy('short_description');
ga.orderByAggregate('COUNT', 'DESC');
ga.setLimit(15);
ga.query();
gs.info('--- Top Onboarding Questions ---');
while (ga.next()) {
gs.info('Topic: ' + ga.short_description + ' | Cases: ' + ga.getAggregate('COUNT'));
}
// Also check onboarding tasks for common task types
gs.info('\n--- Common Onboarding Tasks ---');
var tasks = new GlideAggregate('sn_hr_core_task');
tasks.addQuery('parent.hr_service.name', 'LIKE', 'Onboarding');
tasks.addAggregate('COUNT');
tasks.groupBy('short_description');
tasks.orderByAggregate('COUNT', 'DESC');
tasks.setLimit(10);
tasks.query();
while (tasks.next()) {
gs.info('Task: ' + tasks.short_description + ' | Count: ' + tasks.getAggregate('COUNT'));
}
| Tool | When to Use |
|---|---|
SN-Query-Table | Query HR cases, case types, knowledge bases, categories |
SN-Get-Record | Retrieve specific case or article details |
SN-Create-Record | Create new knowledge articles |
SN-Update-Record | Update article content, state, or metadata |
SN-Execute-Background-Script | Bulk analysis of case patterns, FAQ extraction |
SN-NL-Search | Natural language queries like "resolved benefits cases this quarter" |
| Endpoint | Method | Purpose |
|---|---|---|
/api/now/table/sn_hr_core_case | GET | Query resolved HR cases |
/api/now/table/sn_hr_core_task | GET | Query HR case tasks |
/api/now/table/sn_hr_le_case_type | GET | List HR case types |
/api/now/table/kb_knowledge | GET/POST | Create and query knowledge articles |
/api/now/table/kb_knowledge_base | GET | Find HR knowledge bases |
/api/now/table/kb_category | GET | List knowledge categories |
state=closed_complete and clear close_notes for the best content source materialvalid_to dates aligned with annual policy review cyclesdraft state for HR team review before publishingCause: Query filters too restrictive or cases closed with different terminology
Solution: Broaden the keyword search. Use LIKE operator or SN-NL-Search for flexible matching. Check resolution_code values.
Cause: HR knowledge base not configured or uses a non-standard name
Solution: Query kb_knowledge_base without filters to list all available knowledge bases. Create one if needed via HR administration.
Cause: Article still in draft state or not assigned to a user-facing knowledge base
Solution: Update workflow_state to published. Verify the knowledge base is configured for the HR Service Portal.
Cause: Similar resolved cases generated overlapping content Solution: Search existing articles before creating new ones. Merge duplicate articles by consolidating content into one and retiring the other.
# 1. Find resolved PTO cases
Tool: SN-Query-Table
Parameters:
table_name: sn_hr_core_case
query: state=closed_complete^short_descriptionLIKEPTO^ORshort_descriptionLIKEtime off
fields: number,short_description,close_notes,hr_service
limit: 20
# 2. Create the KB article
Tool: SN-Create-Record
Parameters:
table_name: kb_knowledge
data:
kb_knowledge_base: [hr_kb_sys_id]
short_description: "PTO Policy and Request Process"
text: "[Generated content from case analysis]"
workflow_state: draft
Tool: SN-Query-Table
Parameters:
table_name: sn_hr_core_case
query: state=closed_complete^short_descriptionLIKEenrollment^ORshort_descriptionLIKEbenefits
fields: number,short_description,description,close_notes
limit: 25
Tool: SN-Execute-Background-Script
Parameters:
description: Find HR topics with high case volume but no knowledge articles
script: |
var ga = new GlideAggregate('sn_hr_core_case');
ga.addQuery('state', 'closed_complete');
ga.addQuery('sys_created_on', '>=', gs.daysAgo(90));
ga.addAggregate('COUNT');
ga.groupBy('short_description');
ga.orderByAggregate('COUNT', 'DESC');
ga.setLimit(20);
ga.query();
gs.info('=== TOPICS NEEDING KB ARTICLES ===');
while (ga.next()) {
var topic = ga.short_description.toString();
var count = parseInt(ga.getAggregate('COUNT'));
if (count < 3) continue;
// Check if KB article exists
var kb = new GlideRecord('kb_knowledge');
kb.addQuery('short_description', 'LIKE', topic.substring(0, 30));
kb.addQuery('workflow_state', 'published');
kb.setLimit(1);
kb.query();
if (!kb.hasNext()) {
gs.info('NO ARTICLE: "' + topic + '" | Cases: ' + count);
}
}
hrsd/email-recommendation - Generate HR email responses referencing KB articleshrsd/sidebar-summarization - Summarize HR case context for article creationknowledge/article-generation - General knowledge article creationhrsd/case-summarization - Summarize HR cases before converting to KB content