The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Adding hyperlink work note to RITM via workflow

vw1
Giga Contributor

Hi,

 

I have added a script below to add Work Notes to RITMs. 

var comment = 'Please follow the instructions on Connect: https://community.servicenow.com';
		
var req = new GlideRecord('sc_req_item');
req.addQuery('sys_id', ritmSysId);
req.query();
while(req.next()){
	req.comments = (comment);
	req.update();
}

This code resulted in a comment that shows hyperlink in Service Portal, but not in "Comment Added" email notification.

I have then tried the below script:

...
	req.comments = ('[code]<a href="https://connect.fg.rbc.com/docs/DOC-111720">' + linkName + '</a>[/code]');
	req.update();
...

Which then resulted in a hyperlink in "Comment Added" email notification, and a raw code line (e.g. [code]..[/code]) in Service Portal's RITM Ticket form.

 -> Similar to the screenshot: find_real_file.png 

 

Would like to know if there is a way to display a hyperlink properly in both Service Portal and ServiceNow view of the RITM?

1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

This code works for me both in Portal and console view. Used BR

current.work_notes =' [code]<a href="https://www.servicenow.com">ServiceNow.com</a>[/code]';

find_real_file.png

Regards
Harish

View solution in original post

6 REPLIES 6

Pratiksha Kalam
Kilo Sage

Hello,

var req4 = new GlideRecord('sc_req_item');
req4.addQuery('sys_id',workflow.scratchpad.ritm_id);
req4.query(); // don't forget to query

while(req4.next()){
    req4.work_notes = (msg);
    req4.update();
}

Also refer this link to create hyperlink,

https://community.servicenow.com/community?id=community_question&sys_id=2c344729dbd8dbc01dcaf3231f96...

 

If answer is helpful please mark correct or helpful!

Thanks,

Pratiksha

 

Hello,

 Previously you have marked an answer as correct. But due to multiple answer correct, Now mine answer is not showing mark as correct. It would appreciate if you mark answer as correct.

Thanks,

Pratiksha 

Harish KM
Kilo Patron
Kilo Patron

This code works for me both in Portal and console view. Used BR

current.work_notes =' [code]<a href="https://www.servicenow.com">ServiceNow.com</a>[/code]';

find_real_file.png

Regards
Harish

where to write this code ? we have to write BR for this ?