I want a business rule that copies work notes from a Problem Task to the associated Problem

kranthi2
Tera Expert

Hi,

Create a business rule that copies work notes from a Problem Task to the associated Problem whenever worknotes are added to the Problem Task.

 

Please help me out with the business rule.

 

Thanks,

3 REPLIES 3

Viraj Hudlikar
Giga Sage

Hello @kranthi2 

 

VirajHudlikar_0-1737786560593.png

 

In Advanced section tab under script field add below code:

 

(function executeRule(current, previous /*null when async*/ ) {
    // Add your code here
    var problemRec = new GlideRecord('problem');
    problemRec.addQuery('sys_id', current.problem);
    problemRec.query();
    if (problemRec.next()) {
        problemRec.work_notes = current.work_notes.getJournalEntry(1);
        problemRec.update();
    }
})(current, previous);

 

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar. 

Hi @Viraj Hudlikar 

 

It works, Thanks.

@SreenadhV  - 

Glad that it helped you.

You can also mark it as helpful 👍