Problem with Multi Row Variable Set Elements on Portal Form

jlaps
Kilo Sage

We have a form where user access (breakdowns specifically) are called via API and should display on the form for the option of selecting them to be removed. This stopped working, probably at or around the upgrade to Yokohama. I have traced that the API is receiving the data, the data is coming back to the portal form, and I can see it in alert pop-ups. But the section that should be listing these out does not show. Of course nothing changed and yet it is still broken. Hoping someone can take a look and advise on how to figure out what is not working. Help is greatly appreciated as SN support is calling this a customization when I don't buy that reasoning- something changed, but nothing in the code did.

 

Where the red line is in the below screenshot is where the existing breakdowns should be showing. The "

alert ("returned from include - " + JSON.stringify(obj));" in the script below is showing the correct text in an alert popup.

jlaps_0-1765979256262.png

jlaps_1-1765979422816.png

 

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    //Type appropriate comment here, and begin script below
    g_form.setValue('remove_client_breakdown_access', JSON.stringify([]));
    g_form.setValue('remove_billing_preferences', JSON.stringify([]));
    var ID = g_form.getValue("or_login_id");
    var ga = new GlideAjax("global.BPM_LoginManagement");
    ga.addParam("sysparm_name", "getUserBreakdown");
    ga.addParam('sysparm_id', "");
    ga.addParam('sysparm_id2', ID);
    ga.getXML(callBack);

    function callBack(response) {
        var answer = response.responseXML.documentElement.getAttribute("answer");
        if (answer) {
            obj = [];
            var data = JSON.parse(answer);
            var arr = data.message.toString().split("$");
            for (var i = 0; i < arr.length - 1; i++) {
                temp = arr[i].split(":");
                obj.push({
                    client_number: temp[0],
                    corp_code: temp[1],
                    breakdown_access: temp[2],
                    client_name: temp[3],
                    remove: "No"
                });
				alert ("returned from include - " + JSON.stringify(obj));
                g_form.setValue('remove_client_breakdown_access', JSON.stringify(obj));
				//alert ("after set value - " + remove_client_breakdown_access);
            }
        }
        setTimeout(function() { //for servicenow portal
            disableButtonX();
        }, 3000);
        setTimeout(function() { // for servicenow instance
            disableButtonX1();
        }, 3000);
    }

    var ga1 = new GlideAjax("global.BPM_LoginManagement");
    ga1.addParam("sysparm_name", "getUserPreference");
    ga1.addParam('sysparm_id', "");
    ga1.addParam('sysparm_id2', ID);
    ga1.getXML(callBack_preference);

    function callBack_preference(response) {
        var answer = response.responseXML.documentElement.getAttribute("answer");
        if (answer) {
            obj = [];
            var data = JSON.parse(answer);
            var arr = data.message.toString().split("$");
            for (var i = 0; i < arr.length - 1; i++) {
                temp = arr[i].split(":");
                obj.push({
                    client_number_preference: temp[0],
                    corp_code_preference: temp[1],
                    billing_preference: temp[2],
                    remove_preference: "No"
                });
                g_form.setValue('remove_billing_preferences', JSON.stringify(obj));
            }
        }
        setTimeout(function() { //for servicenow portal
            disableButtonX();
        }, 3000);
        setTimeout(function() { // for servicenow instance
            disableButtonX1();
        }, 3000);

    }

    function disableButtonX() {
        var x = this.document.getElementsByClassName('wrapper-xs fa fa-close'); //icon class name on portal
        alert(x.length);
        var j;
        for (j = 0; j < x.length; j++) {

            x[j].style.display = 'none';
        }

    }

    function disableButtonX1() {
        var x = this.document.getElementsByClassName('btn btn-sm icon-cross multi-row-delete-row'); //icon class name on catalog
        alert(x.length);
        var j;
        for (j = 0; j < x.length; j++) {

            x[j].style.display = 'none';
        }
    }

}

 

 

 

7 REPLIES 7

jlaps
Kilo Sage

When creating a blank new form and adding the variable set in question and using the TRY IT option, it does show the table-

jlaps_0-1765985558595.png

I am not sure why we can't see this on the main form, nor am I certain that the callback data that I have confirmed is available is being populated in there.

I found the problem... one of my devs did a container start without a corresponding container end, which seems to have been the cause of this. Thank you to those that looked at things, but this turned out to be USER ERROR.

Good to know, and yes ServiceNow support should have been able to find this without the cop-out, especially since you showed the correct value was shown in an alert.