Opening Order Guide with Populated Information Problem

litchick10
Tera Guru

My link that populates values in my order guide appears to be working but when selecting Choose Options, a new blank Order Guide opens instead of the form(s).  Order guide opens form correctly when not pre-populating data.

What did I do wrong?

 

Auto fill values

litchick10_0-1758752416580.png

Choose Options

litchick10_1-1758752589285.png

Here's my URL:

/now/nav/ui/classic/params/target/com.glideapp.servicecatalog_cat_item_guide_view.do%3Fv%3D1%26sysparm_initial%3Dtrue%26sysparm_guide%3D7577104bc31fa250d60479bdc00131ff%26sysparm_link_parent%3D0716a834c33b6e10d60479bdc00131e7%26sysparm_catalog%3De0d08b13c3330100c8b837659bba8fb4%26sysparm_catalog_view%3Dcatalog_default%26sysparm_view%3Dcatalog_default?&sysparm_rt=Update&sysparm_sq=2c9022fbc3c0be10d60479bdc0013160

 

Here is the on load client script for parsing parameters (isolate unchecked)

function onLoad() {
        //Use the 'getParameterValue' function below to get the parameter values from the URL
        g_form.clearValue('parameters'); //field to save parms
        var requestType = getParameterValue('sysparm_rt');
        var sqID = getParameterValue('sysparm_sq');
        var parms = '';
        if (requestType) {
            if (sqID) {
                parms = requestType + ";" + sqID;
            } else {
                g_form.clearValue('parameters');
            }
            g_form.setValue('parameters', parms);
        } else {
            g_form.clearValue('parameters');
        }
    }

function getParameterValue(name) {
    var url = document.URL.parseQuery();
    if (url[name]) {
        return decodeURI(url[name]);
    } else {
        return;
    }
}

 

Here's the On Change script to populate the Request Type & Scoping Number (isolate unchecked) when the parameters field changes

function onChange(control, oldValue, newValue, isLoading) {
    if (newValue == '') {
        return;
    }
        var parms = newValue;
        var parmSplit = parms.split(';');
        g_form.setValue('request_type', parmSplit[0]);
        g_form.setValue('sqt_id', parmSplit[1]);
}

 

2 REPLIES 2

TejasSN_LogicX
Tera Contributor

Hi @litchick10 ,

Your link is launching the Order Guide shell, but when you click Choose Options, it spawns a new blank Order Guide because the URL you’re building isn’t fully aligned with how ServiceNow expects order guide parameters to be passed.

 

Why this happens

  1. sysparm_guide should point to the Order Guide sys_id only. If extra params conflict, the platform reloads a blank version.

  2. sysparm_link_parent and sysparm_rt/sysparm_sq are custom pieces you’re appending. They aren’t recognized natively by the order guide engine, so the “Choose Options” step discards your pre-populated values and just rebuilds a fresh guide.

  3. Your onLoad/onChange scripts are writing to a parameters field, but this isn’t tied directly to how order guides pass state between steps. That’s why the forms aren’t carrying over.

You can fix this by :

 

First, strip your URL to the bare minimum:

/com.glideapp.servicecatalog_cat_item_guide_view.do?sysparm_guide=<order_guide_sysid>&sysparm_catalog=<catalog_sysid>

Test that this opens and lets you go to Choose Options without issue.

  • Next, instead of relying on custom params (sysparm_rt, sysparm_sq), use sysparm_default_ variables* (OOB way to pre-populate). For example:

&sysparm_default_request_type=Update&sysparm_default_sqt_id=2c9022fbc3c0be10d60479bdc0013160

This auto-fills your fields and persists across steps.

  • If you must use your custom parsing logic, make sure the field you’re writing (request_type, sqt_id) exists on the guide’s first view so values are captured before “Choose Options” is clicked. Otherwise, the engine resets them.

 

 

If my response/article helped you, please mark it as the correct answer and close the thread — this helps other readers in the community.

Regards,

Tejas 
🚀 ServiceNow Developer | 🏆 HackaNow Finalist | 💡 Community Contributor
📧 Email: tejas.adhalrao11@gmail.com
🔗 LinkedIn: linkedin.com/in/tejas1018

Thank you for the suggestions but while this did open the order guide it didn't populate the values:

 

 

Here is my new URL: https://myinstance.com/com.glideapp.servicecatalog_cat_item_guide_view.do?sysparm_guide=7577104bc31f...

 

I tried with the onload script active and inactive

litchick10_1-1758810435215.png