Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Can we get values from journal Field.

subramani
Mega Contributor

HI,

I need to restore two field values after a step operation.

Please advice me to get the two field values either from journal field ( Here comments in activity log ) or any other best way to restore it.

I don't want to create a dummy field to store it and get it back.

Thanks.

deepak.kanavikar@capgemini.com harishkumarmark.stangerctomasikalai

3 REPLIES 3

Brad Tilton
ServiceNow Employee

I'm not sure I completely understand this use case, but you can grab journal entry values by using getJournalEntry()



https://developer.servicenow.com/app.do#!/api_doc?v=istanbul&id=r_GlideElement-getJournalEntry_Numbe...


Thanks Brad.



But It will return all the fields. I need only two fields value from the Journal Entry, so that I can assign these values to my required field.


You're only running that on a specific field, so if you want the last to work notes you would do current.work_notes.getJournalEntry(2) or for comments you would do current.comments.getJournalEntry(2).



If you're looking for things like the last 2 fields that changed (i.e. assigned to or caller) then you'd need to query that from the history table as the journal entries are specific to the journal fields.