Make the url a short link in URL type field in servicenow

Shubham Deep
Tera Contributor

Hi team,

 

I need some help in shortening the url mentioned under URL type field.

I have a URL type field and under calculated section with calculation type as script and created the dynamic url.  I have given the script something as below:

  
var u_test = g_form.getValue('u_number');


return url; 
 
 
 
The output is coming as long URL. Please guide me how to wrap the link in some customised text say "Link". so that in the form only link can be shown.
1 REPLY 1

Paul Curwen
Giga Sage

If not already enabled, install the Tiny URL Support plugin (com.glide.tiny_url) by following this this:

 

https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/use/navigation/task/t_E...

 

Set the various System properties to the values you require. Make sure 'glide.use_tiny_urls' is set to true

 

glide.tiny_url_min_length (Optional: you only need to create/set it if the standard (1024 chars) is no good.)

 

and then just use the sys_tiny_url table for your own links create the entries in that table using your script.

 

Set the tiny_url column to whatever string you want e.g. mytinyurltest

 

construct your link in your script and place it in the data column of the same record (referencing whatever your tiny_url value used above was) on the sys_tiny_url table

 

Put your script generated link in the data column e.g.

 

https://your-instance.service-now.com/now/nav/ui/classic/params/target/incident_list.do?sysparm_tiny...

 

 

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul