Automatically create a known error article

June Anderson
Tera Contributor

Hello guys 

 

I will like to configure problem to automatically create a known error article when the problem is moved to the closed state

How possible is it to achieve?

 

Thank you all 

1 REPLY 1

Sonam Tiwari
Tera Guru

Hi @June Anderson ,

Try a before BR:

(function executeRule(current, previous /*, ... other inputs if needed */ ) {
    
    if (current.state == 107 && current.state.changes()) { 
        // Create a new Known Error article record
        var newKnownError = new GlideRecord('kb_template_known_error_article');
        newKnownError.initialize(); // Initializes a new record
        newKnownError.short_description = current.short_description; // Copy relevant data from problem record
        newKnownError.kb_description = current.description;
        newKnownError.kb_workaround = current.workaround;
        newKnownError.kb_cause = current.cause_notes;
        
        var articleSysID = newKnownError.insert();
        gs.info("Known Error article created: " + articleSysID);
    }
})(current, previous);