Set Catalog Variables from URL Params (Free tool)

I've had this question come up over and over again in my career:

How do we populate variables on a catalog item or record producer, from the URL?

There are a number of reasons why you might want to do this - for example, imagine you have a generic access request catalog item that lets you choose a group, enter the business justification, and request access to that group.
If you then have a knowledge article about “how to get access to [some system]” that involves filling out that access request form, and requesting to be added to a specific group, you might want to include a link that takes you directly to that catalog item, and pre-populates the relevant variable for you!

There are a couple of ways to do this, but I’ve always only found one-off solutions that require custom code for each and every catalog item, which also means that you have to know in advance, when designing the catalog item, what variables might be specified by URL, their data types, etc.
I got tired of re-engineering the same basic solution over and over again, so I built a generalized tool that should handle all of these potential scenarios. This tool adds to your system, a Variable Set. This variable set contains a catalog client script, but no actual variables (this is expected). The variable set is called “Parse sysparm_variables URI param”.

Once you’ve added the variable set to a given catalog item, you can populate any one or more variables in that catalog item, simply by manipulating the URL.

Simply add a single URI parameter (sysparm_variables) to the URL for any catalog item, and set its value to a JSON-encoded string, with each variable you'd like to populate, and its value. 


You can specify any number of variables and values in this JSON object, as long as you encode any illegal characters (which most browsers will do for you automatically). 
Once you've added the "variable set" containing the necessary script to a catalog item, the exact same sysparm_variables URI parameter, will work for URLs pointing to both the portal, and the classic UI:{"example_user_reference":"5137153cc611227c000bbd1bd8cd2005"}

Additional detailed documentation, and the download link for this free tool is available at the link below, or you can find it by going to Tools > Set Catalog Item Variables from URL in the navigation bar at the top of this site.

Catalog Variable URL Parser