Populate Catalog Item Reference Variable from URL

JoeLighthall
Giga Contributor

From a URL I can redirect to a Catalog Item. This looks like the following and works great.

myinstance.com/com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=bff025bf94cec10062a949ea8250eb79

However I want to populate a reference variable displayed on the Catalog Item. The variable name is group. So far this has been unsuccessful. Below are various ways I have tried to do this (these are what was appended onto the working URL).

&sysparm_query=group=3e849956940e810062a949ea8250eb39 (the sys_id)
&sysparm_query=group=bogus (the name)
&sys_user_group=3e849956940e810062a949ea8250eb39
&sys_user_group=bogus
&sysparm_query=sys_user_group=3e849956940e810062a949ea8250eb39
&sysparm_query=sys_user_group=bogus
&group=3e849956940e810062a949ea8250eb39
&group=bogus


Does anyone have other suggestions?

2 REPLIES 2

Jim Coyne
Kilo Patron

If I understand correctly, you want to auto-populate the variable based on the parameter in the URL, correct? If so, this article on the ServiceNowGuru site should help you out - http://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/

Whereas you can auto-populate fields on a "normal" form based on parameters (https://wiki.servicenow.com/index.php?title=Navigating_by_URL#Open_a_Form_with_Preset_Values), Catalog Items will not do it automatically for you so you need the onLoad script to do it.


JoeLighthall
Giga Contributor

Works like a charm. Most excellent. Thanks!