The CreatorCon Call for Content is officially open! Get started here.

Add Additional Comment from field value when UI Action button is clicked

MStritt
Tera Guru

We have a text field on our Case table called 'Solution Provided' [close_notes]. We also have a UI Action button called 'Propose Solution'. What we'd like to do, is when the agent enters text in the 'Solution Provided' field, then clicks 'Propose Solution', we'd like the following to be added as an Additional Comment in Case Activities.

 

The following solution has been proposed for this Case:
[Solution Provided text]

 

 

8 REPLIES 8

Community Alums
Not applicable

Hi @MStritt ,

Please refer below script 

var desc = current.getValue("field_name");
current.work_notes = desc
current.comments = desc
current.update();

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

James Chun
Kilo Patron

Hi @MStritt,

 

I know this is not exactly what you are after, but have you considered using Response Templates?

https://docs.servicenow.com/bundle/washingtondc-servicenow-platform/page/product/human-resources/con...

It allows users to copy and paste commonly used messages like below:

JamesChun_1-1719863938998.png

 

This will not automatically copy the message to the work note/comment but it allows more flexibility as you can define different messages and allow the agent to modify the message before sending it off.

 

Cheers

Hi James,

 

Not familiar with Response Templates. Just the normal templates from the template bar. Looks pretty cool. But I think the department who's looking for this, is looking for something that is done more automagically. With less intervention as possible. Looks like for this feature, they'd have to do additional steps than the want. I think they just want everything done as soon as they click on the 'Proposed Solution' button.

 

Looks like I might have to copy the current UI Action button for this (Responses), so it's configured on the Case table vs the Task table?

 

MStritt_0-1719865551629.png

 

Hi @MStritt,

 

Yes, you are correct, the Response Template will have that extra step to copy and paste the text.

But this can be used across multiple departments/agents and is more flexible than what they are proposing. Just because they want it, it doesn't mean you have to do it 🙂

 

In regards to the UI Action, since it is configured on the Task table, it should be automatically available on the Case table as it's extended from a Task table.

You would simply need to define a Response Template on the Case table.

JamesChun_0-1719868749644.png