Incident form

Ram012
Tera Contributor

Incident form update work notes "Test"  & Related Records select Problem id like PRB000010 and same work notes "Test" should update in Problem record work notes.

 

Any idea share the code

6 REPLIES 6

Community Alums
Not applicable

HI @Ram012 ,

So sorry, but your question is confusing.

Can you share some screenshots along with some more explaination.

 

SwathiPedireddy
Kilo Sage

Hi @Ram012 

Create a Business rule on incident table with following conditions and script

SwathiPedireddy_0-1743662307695.pngSwathiPedireddy_1-1743662343930.png

Thanks,

Swathi

Robert H
Mega Sage

Hello @Ram012 ,

 

If the Incident is already related to a Problem and you want all Work notes that are now being added to the Incident to by synced to that Problem then create a Business Rule like this:

RobertH_0-1743662788711.png

Script:

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

    var grProblem = current.problem_id.getRefRecord();
    grProblem.work_notes = 'Work notes from parent Incident: ' +
        current.work_notes.getJournalEntry(1);
    grProblem.update();

})(current, previous);

 

But if your requirement is that, the moment a Problem gets related to the Incident, all existing Incident Work notes shall be copied to the Problem, the Condition and Script would need to be modified:

  • Condition: Problem Changes AND Problem is not empty
  • Script: replace the getJournalEntry parameter 1 with -1

Regards,

Robert

Ankur Bawiskar
Tera Patron
Tera Patron

@Ram012 

Please check the approach shared by @Robert H if you want to copy work notes from INC to Related problem

You can also achieve that using flow designer with no scripting

copy notes from INC to PRB.gif

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader