Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to convert Long url to tiny url without processor?

chiranjeevi thi
Tera Contributor

I have a requirement that is convert long URL to tiny URL without using processor because in customers instance we cannot create a processor. I tried with so many articles but couldn't get proper solution. i tried with this code it is not working. is there any solution for this?. find_real_file.png

5 REPLIES 5

Thomas Walker2
Tera Guru

Check out the GlideTinyUrl class. Do a code search in your instance and you can find some examples.

For example:

new GlideTinyURL().createTinyURL(url);

or if you always want it to be a tiny url

new GlideTinyURL().createTinyURLWithCustomLength(url, 10);

Pretty sure it is a global only API so you might need to wrap it in a global script include, but thats alot better than making ajax request from the server to the server haha. The default one will use the system property

glide.tiny_url_min_length

to determine when to generate a TinyURL and when to just passthrough the URL.