How to Populate a Catalog Item Field (configuration_item) Using URL Parameters in ServiceNow?

deepakm29284933
Tera Contributor

How can I populate the configuration_item field on a ServiceNow catalog item by passing a parameter in the URL? I want the field to auto-fill when the user opens the catalog item through a specific link.

If you want, I can also give you the exact script + URL format.

2 REPLIES 2

PradeepReddyA
Tera Contributor

Hi @deepakm29284933 

You can try this catalog client script 

 

function onLoad() {

    // Manually parse the URL parameters

    var test = getParameterValue('yourpaarmeter'); // Get the parameter  from the URL

    if (test) {

        g_form.setValue('varaiable_name", requestedItem);   

    }

function getParameterValue(name) {

    var url = top.location.href;

    var value = new URLSearchParams(url).get(name);

    return value ? value : '';

}

}

Hope that Helps!

Tanushree Maiti
Tera Sage

Hi @deepakm29284933 

 

Refer these posts for the solution:

 

https://www.servicenow.com/community/itsm-forum/fill-catalog-variable-via-url/m-p/2748704

https://www.servicenow.com/community/itsm-forum/prepopulate-fields-on-a-service-catalog-item-using-a...

 

https://www.servicenow.com/community/developer-blog/adventures-in-service-portaling-populate-catalog...

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: