Hi Sheryl,

Can you try to run the code as below; I believe either of that should work

I am doing alert for the url as well; check whether it is coming properly or not

function onLoad() {
    g_form.setMandatory('model_id', true);

    var glideURL = new GlideURL();
    glideURL.setFromCurrent();
    var comp = glideURL.getParam("sysparm_Comp");
    var CI = glideURL.getParam("sysparm_CIname");

    alert('Comp is: ' + comp);
    alert('CI is: ' + CI);


    var url = top.location.href;

    alert('URL is: ' + url);

    var comp2 = new URLSearchParams(url).get("sysparm_Comp");
    var CI2 = new URLSearchParams(url).get("sysparm_CIname");
    alert('Comp2 is: ' + comp2);
    alert('CI2 is: ' + CI2);

}
    

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader