Issue while inserting hyper link in worknotes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
When task is created we are trying to update worknotes on case with task hyperlink by using this script
var task = "[code]<a href='/"+current.sys_class_name+".do?sys_id="+current.sys_id+"'>"+current.number+"</a>[/code]";
parentcase.work_notes = gs.getMessage("Case Task (0) has been created", task);
But we are getting output as
Case Task <a href='*******'>PROT0001261</a> has been created
Instead of hyperlink to the number we are getting like above. Please provide steps to fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @AlfrinAJ , Thanks for your response l. I've tried using this but I ended up getting output as
<a href = "****" target="_blank">Case Task PROT0001268 has been created.</a>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hello @charanpatnala
Please try this:
var url = current.sys_class_name + ".do?sys_id=" + current.sys_id;
var taskLink = "[code]<a href=" + url + ">" + current.number + "</a>[/code]";
var msg = gs.getMessage("Case Task {0} has been created");
msg = msg.replace("{0}", taskLink);
parentcase.work_notes = msg;
parentcase.update();
- The reason your hyperlink may not render correctly is because of gs.getMessage().
- When gs.getMessage() is used, ServiceNow treats the parameter as plain text and escapes HTML for security.
- Because of this, the <a> tag is displayed as text instead of being rendered as a clickable link in the activity stream.
Hope this helps!
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey Thankyou @Juhi Poddar @Tanushree Maiti @AlfrinAJ for your responses, after I gone through community and verifying the system properties i see "glide.ui.security.allow_codetag" was set to false during an system upgrade patch.
Recently the functionality stopped working, so once we make it active this will be resolved i guess.
