How to post comments on associated inc from prb

achen
Tera Contributor

Hello,

 

We have incidents that are associated with problem tickets that are not being updated with information when comments are added to the problem.  Is there a way to add the comments from the problem into the incidents?

 

Thank you,

 

Alex

2 REPLIES 2

Sumanth16
Kilo Patron

Hi @achen , 

Create business rule on problem table with update check box enabled with required condition. And query incident table in script with the associated incident. Add below line in script:

 

current.comments.setJournalEntry('Resolution:\n' + current.close_notes);

 

Plz mark my solution as Accept, If you find it helpful.

 

 

Thanks & Regards,

Sumanth meda

 

 

SN_Learn
Kilo Patron
Kilo Patron

Hi @achen ,

 

Create 'async' business rule as below:

SN_Learn_0-1721418023676.png

 

 

In the Advanced section, paste the below:

(function executeRule(current, previous /*null when async*/ ) {

    updatePrbRelatedInc();

    function updatePrbRelatedInc() {
        var incRec = new GlideRecord("incident");
        incRec.addQuery("problem_id", current.sys_id);
        incRec.query();
        while (incRec.next()) {
            incRec.comments = current.comments.getJournalEntry(1);
            incRec.update();
        }
    }

})(current, previous);

 

Result:

2 incidents are attached to PRB

SN_Learn_1-1721418248335.png

 

Updated the customer update in PRB:

 

SN_Learn_2-1721418315607.png

 

 

Linked Incidents are also showing the same update:

 

SN_Learn_3-1721418375654.png

SN_Learn_4-1721418386847.png

 

 

 

 

Mark this as Helpful / Accept the Solution if this helps

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.