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';
        }
    }

}

 

 

 

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

So 'remove_client_breakdown_access' is the internal name of an MRVS that hasn't changed, nor the containing variables, but it doesn't work anymore? Do you have a pre-Yokohama sandbox instance that you can verify it working before the upgrade?  For a support ticket, I would either mock-up an extremely simplified example that uses the same MRVS, or strip down this onChange script, even removing the GlideAjax call, rather simply set the MRVS value to the stringified object that you know you're getting.  In doing this you may discover the issue, or at least then they can't say it's a customization.

We don't have something from previous no, all three of our instances are affected. Thanks!

Ankur Bawiskar
Tera Patron
Tera Patron

@jlaps 

what's your actual business requirement?

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

If the client/user combination has breakdowns assigned, which is confirmed by the alert popups that not only does the user have them, but the payload is making it back to the form, it should show the table shown in reply below, with the breakdowns listed in that table, allowing them to be REMOVED if the remove checkbox is ticked. 

 

The data is coming back as expected, but the MRVS table/whatever it is, is not showing.