Adding a new Journal Input/List

xiaix
Tera Guru

I'm curious... I need to mimic the behavior of the work_notes field on the incident table.

For example, I know that OOB, this:

xiaix_0-1729785076926.png

allows us to do stuff like this:

 

var je = current.comments_and_work_notes.getJournalEntry(-1);

 

to get all the comments and work notes.

Great. Super. Wonderful.

 

So now I'd like to create the following:

xiaix_1-1729785246579.png

Where I have an API response enter text into the "u_api_response" field, and it get stored into the "u_api_responses" journal list, so that I can do something like this:

 

var je = current.u_api_responses.getJournalEntry(-1);

 

 

So here's the million dollar question.... when the "u_api_response" field gets entered and saved, how do i associate/stuff it into the u_api_responses journal list???

 

Thanks! 😊

1 ACCEPTED SOLUTION

No, it appears you can have 2. You'll just need to format yours to only show the field you want. So I did it the way you originally asked. 

JenniferRah_0-1729795366799.png

In the form design, set the API Responses field to be dependent on API Response, like this:

JenniferRah_2-1729795789330.png

 

The Journal List field didn't show until I had something in the Journal Input field. Then it looked like this: 

JenniferRah_1-1729795745259.png

 

View solution in original post

4 REPLIES 4

JenniferRah
Mega Sage

Sort of, but not really. The Journal Input field allows you to input things into the journal. The Journal List field just shows what's in the journal. 

 

So if you add a new Journal Input field, it will just add those to the existing Journal List field(s). So if I create your Journal Input field as you mentioned and add it to my existing Journal List field, it will show in the activity stream.

JenniferRah_0-1729793910692.png

 

If you wanted to, you could leave the existing activity stream as it is and create another Journal List field as you mentioned. Then for that Journal List field, just configure it to show only the API Responses. I hope that makes sense. This explains the different types of fields and what they do: https://docs.servicenow.com/bundle/xanadu-platform-administration/page/administer/field-administrati... 

Ah, but that's the rub... I do NOT want my new Journal Input entries to show in the existing Journal List field of "comments_and_work_notes"... nor do I want it in the OOB activities formatter.  I want this completely separate. 

 

Are you saying then that there can only be 1 Journal List field on any given table??  If so, that's poor design on SN side.

No, it appears you can have 2. You'll just need to format yours to only show the field you want. So I did it the way you originally asked. 

JenniferRah_0-1729795366799.png

In the form design, set the API Responses field to be dependent on API Response, like this:

JenniferRah_2-1729795789330.png

 

The Journal List field didn't show until I had something in the Journal Input field. Then it looked like this: 

JenniferRah_1-1729795745259.png

 

Yes.... I just noticed that in the documentation you linked, I saw this:

xiaix_0-1729795956877.png

which was the ah-ha moment.

I looked at the "comments_and_work_notes" field's Dependent Field:

xiaix_1-1729796013545.png

So all I have to do now to tie my 2 is do the same on my custom Journal List!

Thank you very much for pointing me in the right direction!