Trying to add display text to a URL field type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2014 01:04 PM
Hi Community,
I have a script that is populating a HTML link into a field type of URL. The script and link are working perfectly but since the full URL in the link column takes up a good portion of list view screen, I'm trying to figure out if it is possible to change the syntax to use a displayed text string instead of the full link yet keep the link functional. Trying to incorporate <a href> tags doesn't work. I'm wondering if anyone else has done this or has any ideas.
Thank you,
Jeff Franklin
Simplified Code Excerpt:
var myLink=gs.getProperty('glide.servlet.uri') + 'time_card_list.do?sysparm_query=user.name%3D' + myList[c-1][1];
tcs.u_link = myLink;
tcs.insert();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2017 12:07 PM
Any updates to this?
Having a similar issue trying to use the UI Action on the List View.
Jeremiah Selander
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2020 09:35 PM
Also, Make Isolate Script to false for the UI Policy otherwise document.getElementByID will not work in Servicenow
Nithya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2023 01:12 AM
Hi,
I'm trying to do a very similar thing on the core_company table with a new URL field, using the following script:
function onCondition() { document.getElementById("core_company.u_url_1").innerHTML = "Click here"; }
But it's not working, I notice that if I inspect the element in my browser the id is actually 'core_company.u_url_1_link', I've also tried this as the id above but still no luck.
I know the script is firing because I tested it with a simple alert("Hello World"); so the UI Policy is otherwise configured correctly.
Any one know why this wouldn't work?
Regards,
Adam...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 12:39 AM
Hi Adam,
Did you happen to set the Isolate script to False? That checkbox is not on the form, I have changed it on the list layout of the UI Policy.
Also for each field, it is needed to append "_link", that is why it wasn't working for me.
Pavel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 09:04 AM
Hi,
I don't recall trying that, like you say it's not on the form. I tried the "_link" to no avail.
But I've changed it completely now so that I don't have this problem anymore, but I'll bare it mind if I ever try something like this again! Thanks...