You are currently viewing How To Shorten ServiceNow URL?

How To Shorten ServiceNow URL?

Hello Spectaculars,

Welcome to the new blog.

We have often seen huge ServiceNow URLs. You can keep on traversing, but it never ends. Check out the question below in the ServiceNow community.

URL becomes too long(beyond 10,000 characters) and gives HTTP error 400

So, with a URL, which is 1000+ characters long, we face many challenges:

  • It looks weird
  • Sharing it with others can be troublesome
  • Hard to understand
  • Hard to manage (copy, paste & navigate)

This problem of huge URLs is not new. Many tools, such as Bitly, offer short and manageable URLs. Just like Bitly, we can shorten URLs in ServiceNow as well. This is achieved via Processors.

Please follow the below steps to shorten your URL

  • Go to your ServiceNow instance.
  • In navigation, go to System Definition -> Processors
  • Click On Processors Module and open the sys_processor table.
  • Click On the New button ( create a new processor )
  • If you do not see the new button, modify the create ACL by activating the Admin override option
  • Add Name, type = script, Path = shortName to be displayed, Script = below code.
(function process(g_request, g_response, g_processor) {
g_processor.redirect('/incident_list.do?sysparm_query=active%3Dtrue%5Elocation%3D105cf7f3c611227501e75e08b14a38ba&sysparm_view=');
	
})(g_request, g_response, g_processor);

Here, under g_processor.redirect(“Add your long url”).

The whole processor page will look like the below page:-

Here, I have shortened the URL to display all Priority 1 Incidents.

So, now you can use the below URL:-

https://dev95794.service-now.com/p1Incidents

and it will redirect to:-

https://dev95794.service-now.com/incident_list.do?sysparm_view=&sysparm_userpref.incident_list.view=&sysparm_userpref.incident.view=&sysparm_query=active%3Dtrue%5Ecategory%3DEmergency&sysparm_fixed_query=

I hope this blog helps you to overcome the long URL issue. Please share your doubts and feedback in the comment section.

end footer

This Post Has One Comment

  1. Johny Deep

    Very Helpful

Comments are closed.