Display hyperlink on form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2023 10:27 PM
Hi ,
I need to display a hyperlink on my form.
Currently the field is displaying entire url.
How can i display the hyperlink without DOM manipulation ?
My current ui policy script :
var message = "Click me!";
document.getElementById("<table_name>.<field_name>_link").innerHTML = message;
I am working in scoped application. The code above is working fine in global but not in scoped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2023 11:21 PM
for DOM manipulation to work fine in scoped app you need to ensure that Isolate script field for your client script is marked as False
Also check this blog
Client-side global JavaScript objects in scoped applications
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2023 11:37 PM
Hi Ankur,
I don't want to use DOM manipulation. Is there any other alternative to display hyperlink ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2023 11:41 PM
you can use annotation and show the link if the link will always be static.
you can also use g_form.addInfoMessage() to show hyper links on form
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 12:42 AM
My link is dynamic.
also, i don't want to display as info message.
This is how it is looking in global.