Make the url a wrapped 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.
2 REPLIES 2

Arun_Manoj
Mega Sage

Hi @Shubham Deep ,

 

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

var url = 'https://myinstance.service-now.com/u_cmdb_abcd_list.do?sysparm_query=query1.u_app_id%3D' + u_test + '&sysparm_first_row=1&sysparm_view=';
var linkText = 'Link';

return '<a href="' + url + '" target="_blank">' + linkText + '</a>';

 

Thanks

Arun

Thanks @Arun_Manoj  for the reply, i have used the suggested code but still it is coming as the whole url in the "URL" type field.