File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Server-Side Components/Business Rules/Auto-Generate-KB-Article Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1+ ( function executeRule ( current , previous /*null when async*/ ) {
2+ try {
3+ // Check if Incident is resolved and has a resolution note
4+ if ( current . state == 6 && current . close_notes ) { // 6 = Resolved
5+ var kbGR = new GlideRecord ( "kb_knowledge" ) ;
6+ kbGR . initialize ( ) ;
7+ kbGR . short_description = "Resolution for Incident " + current . number ;
8+ kbGR . text = current . close_notes ;
9+ kbGR . kb_category = "General" ; // Default category, can be customized
10+ kbGR . workflow_state = "draft" ;
11+ kbGR . u_source_incident = current . sys_id ; // Optional: custom field to track source
12+ kbGR . insert ( ) ;
13+ }
14+ } catch ( ex ) {
15+ gs . error ( "An error occurred while creating a Knowledge Article from Incident." ) ;
16+ }
17+ } ) ( current , previous ) ;
You can’t perform that action at this time.
0 commit comments