Lower performance from réferenced catalog variable

MalikB
Tera Contributor

We have a catalog variable type reference and we wrote 

Ref qualifier: javascript:new SNCFWorkstationQualifier().getQualifier(current.variables.beneficiaireVAR); , Our Script include is :

    getQualifier: function(beneficiaryId) {

        if (gs.nil(beneficiaryId))
            return 'sys_idISEMPTY';

        // Offres Windows autorisées
        var offerIds = gs.getProperty('sncf_windows_offers','');

        if (gs.nil(offerIds))
            return 'sys_idISEMPTY';

        // Relations CI -> Offres Windows
        var ciIds = [];
        var relGR = new GlideRecord('cmdb_rel_ci');

        relGR.addQuery('parent', 'IN', offerIds);
        relGR.query();

        while (relGR.next()) {
            ciIds.push(relGR.getValue('child'));
        }

        if (ciIds.length === 0)
            return 'sys_idISEMPTY';

        // Encoded query finale
        var query =
            'sys_idIN' + ciIds.join(',') +
            '^assigned_to=' + beneficiaryId +
            '^install_status=1' +
            '^asset.asset_function=individuel';

        return query;
    },

And Attributes : ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name,serial_number,ref_ac_order_by=name

 

However the performance of the variable when the user first click on it is 15 to 16 seconds before it shows a result i think we filter in a big table with lots of records, anoyones have an idea how to resolve this issue?

0 REPLIES 0