Punit S
Giga Guru

To "@mention" the caller in the Additional Comments field, you can use the following format: "@<sys_user_name>".

For example, if you want to mention the caller with the user name "john.smith", you can add the following text to the Additional Comments field:

 

@John.smith

 

To insert rich text, you can use HTML tags within the Additional Comments field. For example, to highlight text in bold, you can use the following HTML:

 

<b>Highlighted Text</b>

 

You can also use other HTML tags for formatting, such as <i>  for italics and <u> for underlining.

Here's an example of how you can combine these two features in a script to update the Additional Comments field:

 

// Get the current incident record
var gr = new GlideRecord('incident');
gr.get(current.incident);

// Get the caller user record
var caller = new GlideRecord('sys_user');
caller.get(gr.caller_id);

// Update the Additional Comments field
gr.comments = "Attention @<" + caller.user_name + ">:\n";
gr.comments += "<p><b>Changes required:</b> Please review the updated details and take necessary action.</p>";

// Update the incident record
gr.update();

 

In this example, the script first gets the current incident record and the caller user record. It then constructs the text for the Additional Comments field, using the "@mention" syntax and HTML tags. Finally, it updates the incident record with the new comments.

 

Please mark my answer correct/helpful in case it adds value and moves you a step closer to your desired ServiceNow solution goal. 

Thanks,
Punit