Business Rules creating additional task record with no RITM attached.

samuelbingham
Tera Contributor

Can someone please explain why my business rules are creating another SC_task record after I post the first comment on either RITM table or SC_task table???RITMtoTask1.png

 

RITMtoTask2.png

 

TasktoProvider1.png

 

TasktoProvider2.png

 

3 REPLIES 3

Brian Lancaster
Tera Sage

With a before business rule you should never do an update(). You code should be as simple as 

current.comment = current.work_notes as an example for the one running on the sc_req_item table. This way you do not need glide record. Doing an update() on a before business rule can cause all other business rules for that table to fire.

Thank you for your help!

When I remove the gr.update(). None of the comments sync. 
Code for reference: 

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

    var gr = new GlideRecord('sc_task');
    gr.get(current.number);
    if (current.comments.changes()) {
        gr.work_notes = current.comments;
       

    }
   
    gr.update();



   

})(current, previous);