Adding a field to the Ticket Conversations Widget in Service Portal

shawn_h
Tera Guru

Hi folks,

Looking for a bit of help in adding a field to the Ticket Conversations Widget in the Service Portal.

Ideally, I'd like to populate "close_notes" from a resolved incident, so the user can see what action was taken on resolution.

I've cloned the OOB Ticket Conversations Widget, but I'm at a bit of a loss on how to proceed with building the field into a new entry, as it looks like it's only set up to easily add/remove journal fields, and it's a bit past my scripting ability.

Alternatively, if i used a business rule to copy the close notes into one of the Journal fields so it displayed this way, I'd have to suppress a notification, which isn't ideal and thus isn't my preferred solution.

Would anybody be able to help out please?

1 ACCEPTED SOLUTION

Nia McCash
Mega Sage
Mega Sage

Hi Shawn, 

This is a quick attempt and is far from a complete solution but perhaps it can give you some ideas in the right direction...

I copied the OOB Ticket Conversation Widget and copied the HTML code that represents an entry in the conversation (lines 53-74) to show the close notes. I've commented out lines 61-67 because I didn't want to go into the complexities of figuring out when the close note was posted.  If you'd like that, hopefully you can do that on your own: 

find_real_file.png

In the Server script, I've added a line of code to get the close notes from the ticket.  You'll want to add to this to only fetch the close notes if the ticket is an incident and only if the ticket is closed, and perhaps some other error checks: 

find_real_file.png

With the above, I get something that looks a little like this:

find_real_file.png

 

View solution in original post

15 REPLIES 15

Sumanth16
Kilo Patron

Hi Shawn,

 

Please refer below link:

https://community.servicenow.com/community?id=community_question&sys_id=8e820721dbd8dbc01dcaf3231f961995

 

Thanks,

Sumanth

Hi Sumanth,

 

That one updates the Ticket Fields widget rather than the ticket conversations one.

Afraid that doesn't work when I'm looking to show notes that could be multiple sentences long.

Any other ideas? 

Maverick E
Tera Guru

Hello Shawn,

 

I have done something similar, and I am a beginner myself. Can you elaborate more on what you are trying to accomplish? 

 

For me, I have created a widget on the Ticket Form where the end user may cancel their own request. After cancelling, there would be comments populated like "Ticket was closed by '(name)'". Are you simply trying to inform the user as to why it was rejected or resolved?

Hi Maverick, 

Yes, that's effectively it.

However, we need the notes as to why an incident is resolved to appear as part of the stream in the same area here:

 

find_real_file.png