Journal field onAfter Business Rule

lucr
Kilo Expert

Hi Everyone,

Got a quick question for you.

We have an integration with another instance of servicenow on the requested item table. Now we want to copy over several fields over to the other instance using a soap integration.

We also want to copy over the work_notes of the table to the other instance. However due to performance reasons we want to use the After Business Rule. Now the problem will start to show: "in a After Business Rule how do we access the work_notes?"

Thnx for any help.

Regards,

Luc

1 ACCEPTED SOLUTION

marcguy
ServiceNow Employee
ServiceNow Employee

you have to use getJournalEntry()



current.work_notes.getJournalEntry(1); //will get the last entrie.



current.work_notes.getJournalEntry(-1) //will get all entries



http://wiki.servicenow.com/index.php?title=GlideElement#getJournalEntry.28int.29


View solution in original post

3 REPLIES 3

marcguy
ServiceNow Employee
ServiceNow Employee

you have to use getJournalEntry()



current.work_notes.getJournalEntry(1); //will get the last entrie.



current.work_notes.getJournalEntry(-1) //will get all entries



http://wiki.servicenow.com/index.php?title=GlideElement#getJournalEntry.28int.29


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Luc,



Please refer below script and adjust it as per your req.


var notes = current.work_notes.getJournalEntry(-1); //gets all journal entries as a string where each entry is delimited by '\n\n'


var na = notes.split("\n\n");                                             //stores each entry into an array of strings



for (var i = 0; i < na.length; i++)                                


  gs.print(na[i]);



http://wiki.servicenow.com/?title=Using_Journal_Fields#gsc.tab=0