- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2014 10:52 AM
Hopefully this is an easy one for someone. I added a URL field to my form for users to put specific web addresses (e.g, www.google.com). When they click on the URL, it is appending our instance name before the address (e.g, https://instancename.service-now.com/google.com). How do I prevent the instance name from appending?
Thanks,
Andy
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 07:43 PM
Hi Andrew,
From a similar question I recently answered: URL Field Type
When typing the URL into the field, "http://" or "https://" should be included before the URL. If you leave off the protocol, the url is treated as relative to the instance url. If you include the protocol, the url is treated as an absolute URL. So the url entered should read "http://www.google.com"
The requirement for the protocol prepended to the url is a HTML specification implemented by browsers themselves, so there is no way around that.
Within ServiceNow you could add a client script and/or business rule to check the url field for http:// and add it if it is not present. This would remove the requirement for users to include it themselves. For example:
Client Script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
if ((newValue + '').indexOf('http://') == -1) {
g_form.setValue('url', 'http://' + newValue);
}
}
Business Rule (before)
(function() {
if ((current.url + '').indexOf('http://') == -1) {
current.url = 'http://' + current.url;
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2014 11:41 AM
Ya Pradeep, I know. Never faced this issue before, so I was thinking Andrew can give this a try just in case

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2014 11:42 AM
Yes but unfortunately that will not help here
Thanks,
Pradeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 02:24 PM
Hi Andrew!
Were you able to resolve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 07:43 PM
Hi Andrew,
From a similar question I recently answered: URL Field Type
When typing the URL into the field, "http://" or "https://" should be included before the URL. If you leave off the protocol, the url is treated as relative to the instance url. If you include the protocol, the url is treated as an absolute URL. So the url entered should read "http://www.google.com"
The requirement for the protocol prepended to the url is a HTML specification implemented by browsers themselves, so there is no way around that.
Within ServiceNow you could add a client script and/or business rule to check the url field for http:// and add it if it is not present. This would remove the requirement for users to include it themselves. For example:
Client Script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
if ((newValue + '').indexOf('http://') == -1) {
g_form.setValue('url', 'http://' + newValue);
}
}
Business Rule (before)
(function() {
if ((current.url + '').indexOf('http://') == -1) {
current.url = 'http://' + current.url;
}
})();