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

Rick Seiden
Mega Sage

Angelo,  Is that a link that you're putting in a report?  What I've done will create a static link that you can embed anywhere, even outside of ServiceNow.  You would need to create one of these for each record you want a shortened link to.

I haven't looked at bernyalvarado's suggestions, at least in a few years, so I can't say if they would work or not.

I guess I'd really need more information on what you're trying to do to see if this would work for you.