setJournalEntry isn't working as expected, not changing html to text

Patrick37
Tera Contributor

Have a business rule where I'm trying to convert the HTML to text on INCs but it's not working. Here's my code.

 

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

// Add your code here

var now_GR = new GlideRecord("incident");

now_GR.addQuery("sys_id", current.sys_id);
now_GR.query();

if (now_GR.next()) {
now_GR.work_notes.setJournalEntry(current.description);
now_GR.update();
}
})(current, previous);

 

Does current.field not work in business rules?

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

You don't need to gliderecord your incident, if you are only planning to update the work notes, make sure your BR is Before Insert/Update

Just one line you need to add:

current.work_notes.setJournalEntry(current.description);

Best Regards
Aman Kumar

View solution in original post

3 REPLIES 3

Voona Rohila
Kilo Patron
Kilo Patron

Hi Patrick

Try this logic in your BR

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

current.work_notes.setJournalEntry(current.description);
current.update();

})(current, previous);

 

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Aman Kumar S
Kilo Patron

You don't need to gliderecord your incident, if you are only planning to update the work notes, make sure your BR is Before Insert/Update

Just one line you need to add:

current.work_notes.setJournalEntry(current.description);

Best Regards
Aman Kumar

Vijendra Sainy
Giga Guru

You simply have to write before business rule. For your quick reference I am adding screen shot of before BR.

and into the script part your just to add one line only.

 

current.work_notes.setJournalEntry(current.description);

 

find_real_file.png

 

 


Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful for you!

-Vijendra