Problem have incidents

Abhimitrake
Tera Contributor

Dear Team,

 

(function executeRule(current, previous /*null when async*/ ) {
    // # Assignment 3: Problem have incidents
    // > if problem is updated with worknotes - update the same to all the incident.
    // > if problem is closed - resolved or close all the child incidents.
    var gr = new GlideRecord('incident');
        gs.log('1');
    if (current.work_notes.changes()) {
        gs.log('2');
        gr.addQuery('problem_id', current.sys_id);
        gr.query();
        while (gr.next()) {
                gs.log('3');
            gr.work_notes = current.work_notes;
            gr.setWorkflow(false);
            gr.update();
        }
    }
    if (current.state == '107' || current.state == '106') {
            gs.log('4');
            gr.addQuery('problem_id', current.sys_id);
            gr.query();
            while (gr.next()) {
                    gs.log('5');
                gr.state = '7';
                gr.setWorkflow(false);
                gr.update();
            }

        }
    })(current, previous);
 
 
the Business Rule script is not executed,
 
can anyone help me with this
 
1 REPLY 1

Brian Lancaster
Kilo Patron

What type of business rule is it? What are the conditions on the business rule?

Additional Note: The part about resolving an incident when the problem is resolved exists out of the box. The incident just need to be in the state of on hold and the on hold reason need to be awaiting problem.