Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Auto-Generate Knowledge Article from Resolved Incident

## Overview
This ServiceNow Business Rule automatically creates a draft Knowledge Article when an Incident is resolved and contains resolution notes. It helps promote knowledge reuse and reduces repetitive tickets by capturing solutions directly from resolved Incidents.

## Features
- Triggered when an Incident is moved to the "Resolved" state.
- Checks for presence of resolution notes (`close_notes`).
- Creates a draft Knowledge Article with the Incident number and resolution content.
- Tags the article with a default category (`General`).
- Optionally links the article to the source Incident via a custom field.

## Business Rule Configuration
- **Table**: `incident`
- **When to Run**: `after update`
- **Condition**:
```javascript
current.state == 6 && current.close_notes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(function executeRule(current, previous /*null when async*/) {
try {
// Check if Incident is resolved and has a resolution note
if (current.state == 6 && current.close_notes) { // 6 = Resolved
var kbGR = new GlideRecord("kb_knowledge");
kbGR.initialize();
kbGR.short_description = "Resolution for Incident " + current.number;
kbGR.text = current.close_notes;
kbGR.kb_category = "General"; // Default category, can be customized
kbGR.workflow_state = "draft";
kbGR.u_source_incident = current.sys_id; // Optional: custom field to track source
kbGR.insert();
}
} catch (ex) {
gs.error("An error occurred while creating a Knowledge Article from Incident.");
}
})(current, previous);
Loading