Parmval from a UI Action is not showing up Client Script (both in same tabe)

rob_kling
Tera Contributor

I am experiencing some behaviour whereby I am using a UI Action to produce a separate form and  invoking an onLoad client script. When selecting the UI Action for the first time the parm value is not being picked up the client script, subsequent actions result in the value being passed to the client script

 

UI Action     

var uri = action.getGlideURI();
var path = uri.getFileFromPath() + '';
path = path.substring(0, path.length - 5) + '.do';

uri.set('sys_id', '-1');
uri.set('u_ci_task_type', 'quote prep'); //Passing in Quote Prep for Ci Case Task Client Script to read

path = checkWizard(uri, path);

if (path)
    action.setRedirectURL(uri.toString(path));

action.setNoPop(true);

function checkWizard(uri, path) {
    var already = uri.get('WIZARD:action');
    if (already == 'follow')
        return null;

    var wizID = new GlideappWizardIntercept(path).get();
    if (!wizID)
        return path;

    uri.set('sysparm_parent', wizID);
    uri.deleteParmameter('sysparm_referring_url');
    uri.deleteMatchingParameter('sysparm_list_');
    uri.deleteMatchingParameter('sysparm_record_');
    uri.deleteParmameter('sys_is_list');
    uri.deleteParmameter('sys_is_related_list');
    uri.deleteParmameter('sys_submitted');
    uri.deleteParmameter('sysparm_checked_items');
    uri.deleteParmameter('sysparm_ref_list_query');
    uri.deleteParmameter('sysparm_current_row');

    uri.set('sysparm_referring_url', uri.toString());
    uri.deleteMatchingParameter('fancy.');
    uri.deleteMatchingParameter('sys_rownum');
    uri.deleteMatchingParameter('sysparm_encoded');
    uri.deleteMatchingParameter('sysparm_query_encoded');
    uri.deleteParmameter('sysparm_refer');
    current.work_notes = 'Rate change accepted';
    return 'wizard_view.do';
}

 

Client Script

   

function onLoad() {
    //Populate the variables with the parameters passed in the URL
    //Use the 'getParmVal' function below to get the parameter values from the URL
    var url = top.location.href;
    var Catvalue = new URLSearchParams(url).get("u_ci_task_type");
    alert("BCO0:" + Catvalue);
   
    var gUrl = new GlideURL();
    gUrl.setFromCurrent();
   
    var Catvalue2 = gUrl.getParam("u_ci_task_type");
    alert("BCO02:" + Catvalue2);
   
    var cat = getParmVal('u_ci_task_type');
    g_form.setValue('u_ci_task_type', cat);
 
   
    alert("BCO" + cat);
 
 
Results
 
1st occcurrence
BCO0 ; null
BCO02 : undefined
BCO undefined 
 
2nd occurence
BCO0 : null
BCO02 quote+prep
BCO quote_prep

   

0 REPLIES 0