Constructing Tiny URLs

rickseiden_info
Giga Contributor

Hello,

I know that ServiceNow has a Tiny URL plugin that is supposed to shorten URLs, but I'm wondering if there is a way I can feed it a long URL and have it kick out a shortened URL that I can then pass along to someone.

Our SharePoint team is going to be linking to our Service Catalog.   To point to one catalog item in particular, the link is:

https://instance.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=f220137...

That link is over 255 characters long, and therefore too long for SharePoint (according to our SharePoint team). Our SharePoint team got around this by using goo.gl to shorten the URL.   But management is afraid that when users hover over the link, they'll see the goo.gl URL and be afraid to click on it because it's not an internal or ServiceNow link.

I'd like to know if there is a way that I can manually create a Tiny URL version of that long URL that starts with the instance url:

https://instance.service-now.com/

Thanks

Rick Seiden

1 ACCEPTED SOLUTION

rickseiden_info
Giga Contributor

I managed to do it with Processors (System Definition > Processors).



I created a new Processor of type Script, and put the shortened URL in the "Path" field.   Then I put the following code in the script:



(function process(g_request, g_response, g_processor) {


g_processor.redirect('com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=d38771f4db10c740a47ffb051d961959&sysparm_link_parent=b00565b8dbdc8740a47ffb051d961977&sysparm_catalog=e0d08b13c3330100c8b837659bba8fb4&sysparm_catalog_view=catalog_default');



})(g_request, g_response, g_processor);



It was that "g_processor.redirect(URL)" function that did the trick.


View solution in original post

10 REPLIES 10

bernyalvarado
Mega Sage

Hi Rick,



The following should be helpful:


What is the scope of the Tiny URL plugin?



Thanks,
Berny


bernyalvarado
Mega Sage

Hi Rick,



The following thread will also help you with the task to shorten the urls


Short URL's for Linking to KB Articles. <insntance>.service-now.com/KB02955



Thanks,


Berny


rickseiden_info
Giga Contributor

I managed to do it with Processors (System Definition > Processors).



I created a new Processor of type Script, and put the shortened URL in the "Path" field.   Then I put the following code in the script:



(function process(g_request, g_response, g_processor) {


g_processor.redirect('com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=d38771f4db10c740a47ffb051d961959&sysparm_link_parent=b00565b8dbdc8740a47ffb051d961977&sysparm_catalog=e0d08b13c3330100c8b837659bba8fb4&sysparm_catalog_view=catalog_default');



})(g_request, g_response, g_processor);



It was that "g_processor.redirect(URL)" function that did the trick.


You have got to love it when your search on Google results in your own post, with your own solution, and it works.  Thank you, past self!