Reducing the link size

vrushabh_m
Giga Contributor

I wanted to know about how to reduce the size of a link. I added a URL field to a form in ServiceNow and users can add any URL variable to it. But since URLs are lengthy, it occupies a larger chunk of the form. Is there any way where after user enters the URL and hits the lock button, the size of the URL gets reduced? 

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @vrushabh_m 

 

Request you please share some screenshot. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

I am not supposed to share the screenshot as per the policy of the organization I work for, but as you can see how a link is automatically truncated when you enter it in microsoft teams chat, similarly I was hoping if there is a way to truncate the link that is entered in the URL field.

 

Hi @vrushabh_m 

 

not 100% sure, but have look here

https://www.servicenow.com/community/itsm-articles/how-to-shorten-servicenow-urls/ta-p/2310367

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Gangadhar Ravi
Giga Sage
Giga Sage

you can try onLoad script like below. replace u_my_url_field_link with your field name.

function onLoad() {
  var url = g_form.getValue("u_my_url_field");
  if(url && url.length > 100) {
    var short_url = url.substring(0, 100) + "...";
    document.getElementById("change_request.u_my_url_field_link").innerHTML = short_url;
  }
}

Please mark my answer correct and helpful if this works for you.