Need help in adding a link in String type field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2020 08:37 AM
Hi Community,
I need help in adding a link in String type field. How can we store a link/add a link in String type field ?
Any help would be greatly appreciated.
Thanks
Pihu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2020 08:42 AM
String field does not hold hyperlink on form. May i know the use case ?
if you are looking on list view there is workaround.
http://www.john-james-andersen.com/blog/service-now/making-linky-lists-in-servicenow-list-views.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2020 08:43 AM
Hi,
A string type field cannot hold a link(or any html)
You can create a URL field, or you can create a HTML type of field.
Link can be stored in work notes/comments, ie. journal fields.
-Anurag

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2020 08:46 AM
You can do it with onload client script.
Below is the example script.
The below script assumes the name of the field is "u_url" and it has a value of "Click here".
function onLoad() {
g_form.getControl('u_url').style.color = 'blue'; // Set text font color to blue
g_form.getControl('u_url').style.textDecoration = "underline"; // Set text decoration to underlined
g_form.getControl('u_url').onmouseover = mouseOver; // Set mouseOver cursor style
g_form.getControl('u_url').onclick = urlFunction; // Set onclick to the redirect url
}
function mouseOver() {
this.style.cursor = 'hand'; // Set onmouseover cursor style
}
function urlFunction() {
window.top.location.href = 'http://www.google.com'; // This is the url that the user will be redirected to
}
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2024 11:00 PM
After clicking that is not getting opened in next tab