Insert URL link in an Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2014 01:07 PM
Is there a way to insert a hotlink in an incident? We want the ability to insert a URL link either in the short description or additional comments section and have the link open in a new tab. Any feedback much appreciated!
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2016 03:46 PM
I am importing data to Contract form(ast_contract) via import sets.I want to display a link in the Description field . I tried [code]-----[/code] in the field value in the Excel formula. But it is printing as such.Not escaping HTML or link displayed. Any help is appreciated. Is there a way other than a URL field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2016 05:50 AM
You cannot show a link in a Description field as this is a basic HTML text input element. The script shown in this thread works on Journal fields like Comments/Work Notes as they are rendered differently on the page. Apart from a URL field (which is the easiest method), you could create a Macro/Formatter and use DOM to insert your link (or at least the target value) into an element you define. The formatter could be placed on the form just as any other field element would be, and your Client Script could add the value. If the value (URL etc) needs to be stored somewhere on the current record (e.g in a String field), then it's probably just easier to store it in a URL field in the first place.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2016 08:21 AM
Thank you so much for the detailed explanation. Cleared all my questions. I think I will be able to achieve it with a Macro/Formatter alone since I can create the URL link using one of the form field values. The only thing that changes in the URL is a purchase order number, which is a field value. I wish I could mark this as the correct answer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2014 05:28 AM
Hi Rhonda,
Building on what Bhavesh said, you could write some additional code into an onSubmit client script to replace the URL text with the necessary html hyperlink. The code shown below will replace all detected URLs in the comments or work notes fields when the form is saved, so that they appear as hyper links in the Activity field. I modified the code slightly to retain the blue text colour and to open links in a new tab. The original "urlify" function was taken from a Stack Overflow forum.
function onSubmit() {
// check comments and add href
var new_comments = g_form.getValue('comments')+'';
if(new_comments!=''){
g_form.setValue('comments', urlify(new_comments));
}
// check notes and add href
var new_notes = g_form.getValue('work_notes')+'';
if(new_comments!=''){
g_form.setValue('work_notes', urlify(new_notes));
}
}
// function to create link
function urlify(text) {
var urlRegex = /(https?:\/\/[^\s]+)/g;
return text.replace(urlRegex, function(url) {
return '[code]<a class="web" target="_blank" href="' + url + '">' + url + '</a>';
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2015 11:02 AM
Jake, thanks for the idea. In using your script example I ended up making a few minor changes re: in your example, the work_notes section referred to same var as comments. Also, I modified the return value in the last line to follow example by Bhavesh but otherwise this seems to be working well for me!
function onSubmit() {
// check comments and add href
var new_comments = g_form.getValue('comments')+'';
if(new_comments!=''){
g_form.setValue('comments', urlify(new_comments));
}
// check notes and add href
var new_notes = g_form.getValue('work_notes')+'';
if(new_notes!=''){
g_form.setValue('work_notes', urlify(new_notes));
}
}
// function to create link
function urlify(text) {
var urlRegex = /(https?:\/\/[^\s]+)/g;
return text.replace(urlRegex, function(url) {
return '[code]<p><a class="web" target="_blank" href="' + url + '">' + url + '</a></p>[/code]';
});
}