How to retrieve work notes of a record (incident , sc_request) into catalog form?

NiharikaC
Tera Contributor

Is it possible to achieve this below scenario

When a user inputs a ticket number in the field, it should display a list of related journal entries/work notes in the field below, allowing the user to select from the options.

 
 
 
 
 
4 REPLIES 4

sreeram_nair
Tera Guru

To achieve this functionality, you can use a Reference Qualifier and a Dynamic Filter Option in ServiceNow.

To display related journal entries/work notes based on a ticket number in ServiceNow:

  1. Create Fields:
    • Field 1: Ticket Number (Reference to Task table).
    • Field 2: Related Journal Entries (Reference to Journal Entry table).
  2. Set Reference Qualifier:
    • For the Related Journal Entries field, add this script:
      current.addQuery('element_id', current.u_ticket_number);
    • This filters journal entries based on the selected ticket number.
  1. Add Field Dependency:
    • Set the Related Journal Entries field as dependent on Ticket Number so it updates dynamically.
  2. Test:
    • Enter a ticket number and verify that the related journal entries populate correctly in the second field.

ɪꜰ ᴍʏ ᴀɴꜱᴡᴇʀ ʜᴀꜱ ʜᴇʟᴘᴇᴅ ᴡɪᴛʜ ʏᴏᴜʀ Qᴜᴇꜱᴛɪᴏɴ, ᴘʟᴇᴀꜱᴇ ᴍᴀʀᴋ ᴍʏ ᴀɴꜱᴡᴇʀ ᴀꜱ ᴛʜᴇ ᴀᴄᴄᴇᴘᴛᴇᴅ ꜱᴏʟᴜᴛɪᴏɴ ᴀɴᴅ ɢɪᴠᴇ ᴀ ᴛʜᴜᴍʙꜱ ᴜᴘ.




ʙᴇꜱᴛ ʀᴇɢᴀʀᴅꜱ


ꜱʀᴇᴇʀᴀᴍ

I set the Related Journal Entries field as dependent on Ticket Number but it showing all the records in second field that too displaying only "name" field

Ankur Bawiskar
Tera Patron
Tera Patron

@NiharikaC 

you will have to query sys_journal_field table where work notes are stored and bring in the data

what script did you try so far and what didn't work?

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

NiharikaC_0-1736964416898.png

I tried this in the variable but it is not working , based on the task number it should display additional comments associated to it