List Collector Variable being cleared after submission

Josh Evans
Tera Contributor

Hello,

 

I have a list collector variable being cleared after submission. This variable is a part of 2 separate forms. It does not get cleared in the original form, but on the other it is after the request is submitted. Both variables have the same reference qualifier calling the same script include, and the same client scripts and ui policies associated with them.

Original Form:

JoshEvans_0-1720625069247.pngJoshEvans_1-1720625144269.png

JoshEvans_2-1720625241314.png

 

Other Form:

JoshEvans_3-1720625376160.png

JoshEvans_4-1720625446100.png

JoshEvans_5-1720625493603.png

 

Code in script include: 

var GetCountry = Class.create();
GetCountry.prototype = {
    initialize: function() {
    },
   
    getCountryid: function(system) {
        gs.log('GRC getCountryid: system: ' + system);
        var arr_sys = []; //array of connectors (e.g., E1PCLNT100)
        var arr = [];
        var arr1;
        var connectorString = '';
        var qry = 'sys_idIN' + system;
        gs.info('GRC getCountryid: qry: ' + qry);
        //gs.addInfoMessage('GRC getCountryid: qry: ' + qry);
        var grqc = new GlideRecord('u_grc_systems'); //switched to a table as the source for systems
        grqc.addEncodedQuery(qry);
        grqc.query();
        gs.info(grqc.getRowCount());
        while(grqc.next()) {
            connectorString = connectorString + grqc.u_connector_name + ',';
        }

        if(connectorString.charAt(connectorString.length - 1)==','){
            connectorString = connectorString.substr(0,connectorString.length-1);
        }

        var qryc = 't_u_connectorIN' + connectorString;
        gs.info('GRC getCountryid: qryc: ' + qryc);
       
        var grbr = new GlideAggregate('u_grc_vw_brole_trole_connector');
        grbr.addEncodedQuery(qryc);
        grbr.groupBy('b_u_country_area');
        grbr.addAggregate('COUNT','t_sys_id');
        grbr.query();
        while(grbr.next()) {
            arr.push(grbr.getValue('b_u_country_area'));
        }
        var val = 'sys_idIN' + arr.toString();
        gs.info('GRC getCountryid: val: ' + val);
        return val;
    },
Variable getting cleared after submission:
JoshEvans_0-1720625605734.png

 

Any help would be greatly appreciated.
 
Thanks!

 

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @Josh Evans 

Can you check, by any chance 'clear value' is checked in UI Policy Action.

 

And also any other catalogs or UI policies for the same catalog causing this issue.

Thanks,
Anvesh

View solution in original post

1 REPLY 1

AnveshKumar M
Tera Sage
Tera Sage

Hi @Josh Evans 

Can you check, by any chance 'clear value' is checked in UI Policy Action.

 

And also any other catalogs or UI policies for the same catalog causing this issue.

Thanks,
Anvesh